ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doug Lochart" <>
Subject Re: Basic Questions about Classpath
Date Wed, 14 Jul 2004 15:32:06 GMT

1.  This is my understaning.  I looked into the CommandLineJava source file of ant and it
looks as if this is the case
2.  Again this is correct to my understanding.

First of all I never rely on or specifically set a CLASSPATH in the environment when I run
ant or any java application.  I believe on setting the environment on a per process basis.
 That being said if the exact same ant script runs on XP and not on 2000 then my best guess
would be that the CLASSPATH env var is being set differently on each machine.  Meaning that
the XP machine might be setting the CLASSPATH as a System (global) variable and the 2000 machine
might be setting as a user variable different from the user logged in or more likely there
is a System var set is correct but there might be a CLASSPATH var set for the user logged
in that is masking the one you think is being used.

If this is not the case I recommend setting the classpath spcifically within the java task
and removing from the environment altogether.  If this does not fix your problem then I recommend
running ant -diagnostics on both machines as well as running the script in debug mode for
both machines to see what may be the problem.  I faintly recall another issue with environment
variables XP vs Win2000 but I don't think it applies here.


Now I've gained some understanding 
Of the only world that we see.
Things that I once dreamed of
Have become reality.

These walls that still surround me
Still contain the same old me,
Just one more who's searching for
A world that ought to be.
  ----- Original Message ----- 
  From: Rhino 
  To: ant-user 
  Sent: Wednesday, July 14, 2004 9:12 AM
  Subject: Basic Questions about Classpath

  I am trying to help my friend Ron with a problem we were having on his Windows 2000 machine
yesterday. He has already posted about it but I just want to review the basic concept in case
I'm missing something conceptual. These questions refer to Ant 1.6.1.
    1.. Am I right in assuming that a <java> task that does not contain a classpath
attribute will use the value of the system property java.class.path, which is derived from
the CLASSPATH environment variable currently in effect? Will this be true for both <java>
tasks that are executing .class files and <java> tasks that are executing jar files?

    2.. Am I right that a <java> task which *does* contain a classpath attribute will
use only the classpath specified in the attribute and ignore any classpath set in the CLASSPATH
environment variable?
  I am trying to understand why a <java> task that I wrote works fine on XP without
any classpath attribute yet doesn't work on Windows 2000, regardless of whether I use a classpath
attribute or not. On both platforms, the CLASSPATH environment variable includes the jar file
the program needs to see in order to execute correctly.

  rhino1 AT sympatico DOT ca
  "There are two ways of constructing a software design. One way is to make it so simple that
there are obviously no deficiencies. And the other way is to make it so complicated that there
are no obvious deficiencies." - C.A.R. Hoare
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message