You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Graham Reeds <gr...@ntlworld.com> on 2004/01/11 15:42:08 UTC

Ant 1.6.0 Long Filename support

W2K, Ant 1.6.0

I recently upgraded the version of Tomcat and so I also changed my install
directory from the root to Program Files.  I also took the liberty of
upgrading Ant from 1.5.x to 1.6.

I have 'tool' that I run from TextPad that calls Ant.bat.  However I get the
following message:

Files\Apache was unexpected at this time.

Tool completed with exit code 255

Does this mean that I can't use Ant with my Tomcat setup (which resides in
C:\Program Files\Apache Group\apache-ant-1.6.0

I have double checked my ANT_HOME and paths but everything checks out.
Tomcat runs fine and servlets compile ok, so shouldn't Ant be able to work
with long filenames too?

--

Graham Reeds,
grahamr@ntlworld.com



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Ant 1.6.0 Long Filename support

Posted by Jacob Kjome <ho...@visi.com>.
At 04:18 PM 1/11/2004 +0000, you wrote:
> > You are going to have to quote all paths that contain spaces such as...
> >
> > ANT_HOME = "C:\Program Files\Apache Group\apache-ant-1.6.0"
> > JAVA_HOME = "C:\Program Files\Java\jdk1.3.1_09"
>
>That's puts me straight back to square one.  Removing the quotes from around
>just ANT_HOME gave me another error:
>'Files\Java\jdk1.3.1_09"" was unexpected at this time.'
>All my paths in PATH are quoted too.

I guess I gave you bad information as Conor has stated.  Sorry about 
that.  Either way, you can avoid this by using my suggestion below...

> > Why don't you save yourself a million headaches and just install anything
> > Java-related to a path with no spaces such as...
> >
> > ANT_HOME = C:\apache-ant-1.6.0
> > JAVA_HOME = C:\jdk1.3.1_09
> >
> > Everything will work in this case.  Even if things *should* work in the
> > other case, they *do* in this case, so save yourself the trouble
> > and always use paths without spaces.
>
><small rant>But I hate an untidy directory structure.  It bugs the hell out
>of me that I have to have multiple programs in root at work.  ESRI, Oracle
>and Tomcat all have trouble with directories with spaces.  Long filenames
>have been around for 8 years.  Programs should be able to work with them by
>now. </small rant>

Like I said, maybe it *should* work, but the fact that it works only 
sporadically when you use paths with spaces and it works perfectly when you 
use paths without spaces should give you pause at ever using spaces for 
paths to Java programs.  And  you needn't use the exact paths I 
suggested.  You could have...

ANT_HOME = C:\Java\Apache\apache-ant-1.6.0
JAVA_HOME = C:\Java\Sun\jdk1.3.1_09

What's so hard about that?  There's nothing magical about "Program 
Files".  Use any naming convention you want, just make sure to remember to 
avoid paths with spaces for Java programs.  It might be lame, but you might 
think about picking your battles and not spending any more energy on an 
issue outside of your control.

Jake



>Graham.
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Ant 1.6.0 Long Filename support

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
> From: Jacob Kjome [mailto:hoju@visi.com]
> Sent: Monday, 12 January 2004 3:01 AM
> To: Ant Users List
> Subject: RE: Ant 1.6.0 Long Filename support
>
> You are going to have to quote all paths that contain spaces such as...
>
> ANT_HOME = "C:\Program Files\Apache Group\apache-ant-1.6.0"
> JAVA_HOME = "C:\Program Files\Java\jdk1.3.1_09"


This is incorrect. You do not need to quote environment variables, even
those containing spaces. Ant should handle them without issue. If it does
not, then that is a bug.

Conor


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Ant 1.6.0 Long Filename support

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
> From: Graham Reeds [mailto:grahamr@ntlworld.com]
> Sent: Monday, 12 January 2004 3:18 AM
> To: Ant Users List
> Subject: RE: Ant 1.6.0 Long Filename support
>
>
> That's puts me straight back to square one.  Removing the quotes
> from around
> just ANT_HOME gave me another error:
> 'Files\Java\jdk1.3.1_09"" was unexpected at this time.'
> All my paths in PATH are quoted too.

Well that may be a problem. In general, you do not need quotes in
environment variables, even those with spaces. Ant.bat quotes the usage of
environment variables at the point of usage and if they already contain
quotes, there will be problems.

The best way to debug these problems is to turn echo on in the ant.bat file
and see where it runs into problems.

Also, I would start from a command line shell to get things sorted out
before using your textpad 'tool'.

> <small rant>But I hate an untidy directory structure.  It bugs
> the hell out
> of me that I have to have multiple programs in root at work.  ESRI, Oracle
> and Tomcat all have trouble with directories with spaces.  Long filenames
> have been around for 8 years.  Programs should be able to work
> with them by
> now. </small rant>
>

Well, perhaps when they added support for long filenames, they could have
upgraded the command interpreter too and made its operation uniform across
the different versions of Windows.

Conor


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Ant 1.6.0 Long Filename support

Posted by Graham Reeds <gr...@ntlworld.com>.
> You are going to have to quote all paths that contain spaces such as...
>
> ANT_HOME = "C:\Program Files\Apache Group\apache-ant-1.6.0"
> JAVA_HOME = "C:\Program Files\Java\jdk1.3.1_09"

That's puts me straight back to square one.  Removing the quotes from around
just ANT_HOME gave me another error:
'Files\Java\jdk1.3.1_09"" was unexpected at this time.'
All my paths in PATH are quoted too.

> Why don't you save yourself a million headaches and just install anything
> Java-related to a path with no spaces such as...
>
> ANT_HOME = C:\apache-ant-1.6.0
> JAVA_HOME = C:\jdk1.3.1_09
>
> Everything will work in this case.  Even if things *should* work in the
> other case, they *do* in this case, so save yourself the trouble
> and always use paths without spaces.

<small rant>But I hate an untidy directory structure.  It bugs the hell out
of me that I have to have multiple programs in root at work.  ESRI, Oracle
and Tomcat all have trouble with directories with spaces.  Long filenames
have been around for 8 years.  Programs should be able to work with them by
now. </small rant>


Graham.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Ant 1.6.0 Long Filename support

Posted by Jacob Kjome <ho...@visi.com>.
You are going to have to quote all paths that contain spaces such as...

ANT_HOME = "C:\Program Files\Apache Group\apache-ant-1.6.0"
JAVA_HOME = "C:\Program Files\Java\jdk1.3.1_09"

Why don't you save yourself a million headaches and just install anything 
Java-related to a path with no spaces such as...

ANT_HOME = C:\apache-ant-1.6.0
JAVA_HOME = C:\jdk1.3.1_09

Everything will work in this case.  Even if things *should* work in the 
other case, they *do* in this case, so save yourself the trouble and always 
use paths without spaces.

Jake


At 03:34 PM 1/11/2004 +0000, you wrote:
> > Hi Graham,
> >
> > your issue seems more connected to spaces in paths that to long
> > file names.
> >
> > Can you tell us :
> > - what is "tool" (a .bat file ?) that you run from TexPad,
>
>The tool is the ant.bat that comes with Ant and resides in %ANT_HOME%\bin.
>
> > - what is the value of ANT_HOME in your system,
>
>ANT_HOME = C:\Program Files\Apache Group\apache-ant-1.6.0
>
> > - what is the value of JAVA_HOME
>
>JAVA_HOME = C:\Program Files\Java\jdk1.3.1_09
>
> > - is CLASSPATH set as an environment variable before you start ant; if
> > it is set, can you try running ant without CLASSPATH,
>
>When I run without the CLASSPATH it complains that build.xml wasn't found
>(my working directory had defaulted to desktop due to the text file that
>held my CLASSPATH settings). Change to my working directory and - hey
>presto - it worked (sort of).
>
> > - can you start ant from the command prompt (directly without TextPad
> > and your "tool"),
>
>When I run it with CLASSPATH set it gives 'Files\Apache was unexpected at
>this time.'  Works without.
>
>However I now get compile errors with
>
>     [javac] Compiling 1 source file to
>C:\java\jakarta-tomcat-3.2.3\webapps\utopia\WEB-INF\classes
>     [javac] D:\develop\www.digital-utopia.co.uk\src\UtopiaServlet.java:8:
>package javax.servlet does not exist
>     [javac] import javax.servlet.*;
>
>Which means it can't import the packages - CLASSPATH is still needed.  I
>tried setting the CLASSPATH in the ant.bat but that brings back the earlier
>error.
>
>I thought CLASSPATH was an integral part of Tomcat and ergo reluctant to
>remove it.  I am suprised that when I had tomcat and apache installed in
>directories without spaces I never encountered this error or is this a new
>feature with 1.6?
>
>Take care,
>Graham Reeds.
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant 1.6.0 Long Filename support

Posted by Antoine Lévy-Lambert <an...@antbuild.com>.
Graham Reeds wrote:

>
>>- what is the value of ANT_HOME in your system,
>>    
>>
>
>ANT_HOME = C:\Program Files\Apache Group\apache-ant-1.6.0
>
>  
>
>>- what is the value of JAVA_HOME
>>    
>>
>
>JAVA_HOME = C:\Program Files\Java\jdk1.3.1_09
>
>  
>
>>- is CLASSPATH set as an environment variable before you start ant; if
>>it is set, can you try running ant without CLASSPATH,
>>    
>>
>
>When I run without the CLASSPATH it complains that build.xml wasn't found
>(my working directory had defaulted to desktop due to the text file that
>held my CLASSPATH settings). Change to my working directory and - hey
>presto - it worked (sort of).
>
>  
>
>>- can you start ant from the command prompt (directly without TextPad
>>and your "tool"),
>>    
>>
>
>When I run it with CLASSPATH set it gives 'Files\Apache was unexpected at
>this time.'  Works without.
>
>  
>

1) it sounds like there is a bug in ant.bat which is showing up when 
CLASSPATH contains embedded spaces. I need to check this.

>However I now get compile errors with

>    [javac] Compiling 1 source file to
>C:\java\jakarta-tomcat-3.2.3\webapps\utopia\WEB-INF\classes
    [javac] D:\develop\www.digital-utopia.co.uk\src\UtopiaServlet.java:8:
>package javax.servlet does not exist
    [javac] import javax.servlet.*;

>Which means it can't import the packages - CLASSPATH is still needed.  I
>tried setting the CLASSPATH in the ant.bat but that brings back the earlier
>error.

2) to run ant without CLASSPATH set, change your build files to include explicitly servlet.jar or j2ee.jar in the classpath when compiling your servlets,

using the classpath nested element of javac.

something like this
<property environment="env"/>
<javac ....>
    <classpath>
           <pathelement 
location="${env.CATALINA_HOME}/common/lib/servlet.jar"/>
          ... other path elements needed to compile your servlets
     </classpath>
</javac>

> I thought CLASSPATH was an integral part of Tomcat and ergo reluctant to
> remove it.  I am suprised that when I had tomcat and apache installed in
> directories without spaces I never encountered this error or is this a new
> feature with 1.6?

I would be surprised to hear that there is a requirement to have the 
CLASSPATH environment variable set at system level to be able to run tomcat.
I had installed a 4.x tomcat on my PC and there was no such requirement.


Cheers,

Antoine


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Ant 1.6.0 Long Filename support

Posted by Graham Reeds <gr...@ntlworld.com>.
> Hi Graham,
>
> your issue seems more connected to spaces in paths that to long
> file names.
>
> Can you tell us :
> - what is "tool" (a .bat file ?) that you run from TexPad,

The tool is the ant.bat that comes with Ant and resides in %ANT_HOME%\bin.

> - what is the value of ANT_HOME in your system,

ANT_HOME = C:\Program Files\Apache Group\apache-ant-1.6.0

> - what is the value of JAVA_HOME

JAVA_HOME = C:\Program Files\Java\jdk1.3.1_09

> - is CLASSPATH set as an environment variable before you start ant; if
> it is set, can you try running ant without CLASSPATH,

When I run without the CLASSPATH it complains that build.xml wasn't found
(my working directory had defaulted to desktop due to the text file that
held my CLASSPATH settings). Change to my working directory and - hey
presto - it worked (sort of).

> - can you start ant from the command prompt (directly without TextPad
> and your "tool"),

When I run it with CLASSPATH set it gives 'Files\Apache was unexpected at
this time.'  Works without.

However I now get compile errors with

    [javac] Compiling 1 source file to
C:\java\jakarta-tomcat-3.2.3\webapps\utopia\WEB-INF\classes
    [javac] D:\develop\www.digital-utopia.co.uk\src\UtopiaServlet.java:8:
package javax.servlet does not exist
    [javac] import javax.servlet.*;

Which means it can't import the packages - CLASSPATH is still needed.  I
tried setting the CLASSPATH in the ant.bat but that brings back the earlier
error.

I thought CLASSPATH was an integral part of Tomcat and ergo reluctant to
remove it.  I am suprised that when I had tomcat and apache installed in
directories without spaces I never encountered this error or is this a new
feature with 1.6?

Take care,
Graham Reeds.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant 1.6.0 Long Filename support

Posted by Antoine Lévy-Lambert <an...@antbuild.com>.
Graham Reeds wrote:

>W2K, Ant 1.6.0
>
>I recently upgraded the version of Tomcat and so I also changed my install
>directory from the root to Program Files.  I also took the liberty of
>upgrading Ant from 1.5.x to 1.6.
>
>I have 'tool' that I run from TextPad that calls Ant.bat.  However I get the
>following message:
>
>Files\Apache was unexpected at this time.
>
>Tool completed with exit code 255
>
>Does this mean that I can't use Ant with my Tomcat setup (which resides in
>C:\Program Files\Apache Group\apache-ant-1.6.0
>
>I have double checked my ANT_HOME and paths but everything checks out.
>Tomcat runs fine and servlets compile ok, so shouldn't Ant be able to work
>with long filenames too?
>
>--
>
>Graham Reeds,
>grahamr@ntlworld.com
>
>
>
>  
>
Hi Graham,

your issue seems more connected to spaces in paths that to long file names.

Can you tell us :
- what is "tool" (a .bat file ?) that you run from TexPad,
- what is the value of ANT_HOME in your system,
- what is the value of JAVA_HOME
- is CLASSPATH set as an environment variable before you start ant; if 
it is set, can you try running ant without CLASSPATH,
- can you start ant from the command prompt (directly without TextPad 
and your "tool"),

Cheers,

Antoine


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org