If I have my classpath Windows XP environment variable defined, in this case .;C:\Sun\AppServer\lib\javaee.jar;C:\Java\lib\mysql.jar;, is it still necessary to define the classpath in the build.xml for Ant?
If yes can you help me convert the classpath shown above to what Ant requires?
Code and Ant output below.
Thanks,
Lou
File build.properties
File build.xml
Ant output
Lou Pellegrini
Ranch Hand
Joined: Nov 11, 2003
Posts: 105
posted
0
I got it.
First in your buld.properties file
Lou.classpath=C:/Sun/AppServer/lib/javaee.jar;C:/Java/lib/mysql.jar
Second in your build.xml file
<path id="classpath.base">
<pathelement path="${Lou.classpath}"/>
</path>
Then add to your compile target in build.xml
<classpath refid="classpath.base"/>
If I have my classpath Windows XP environment variable defined, in this case .;C:\Sun\AppServer\lib\javaee.jar;C:\Java\lib\mysql.jar;,
Just an side, but setting the CLASSPATH env var globally is a very bad idea. At some point some Java code will break and you will spend countless hours tracking down the issue only to find out that is was because you set CLASSPATH globally and the Java app was therefore picking up the wrong classes.
Peter Johnson wrote:
Just an side, but setting the CLASSPATH env var globally is a very bad idea. At some point some Java code will break and you will spend countless hours tracking down the issue only to find out that is was because you set CLASSPATH globally and the Java app was therefore picking up the wrong classes.
Thank you for the information Peter, and for saving me countless future hours. I have removed the classpath from my environment variables.
I have been wondering, and perhaps you could answer, how to deploy and use my war and jar files.
Would it be best to deploy my jar files for db connections to $CATALINA_HOME\lib and then use $CATALINA_HOME\lib for my classpath, or some other configuration?
Have you looked at Maven? It is very good at organizing and maintaining JAR files, and it removes the need to clutter up your Eclipse projects with lib directories containing JAR files. Especially handy if you have multiple projects and they all use very similar sets of JARs.