• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help in setting classpath in ant

 
Thomas Greene
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using windows2000 and have installed ant in D Drive.
My directory structure is something like

D:\ant\source\src\com\pack1\pack2 (com\pack1\pack2 are packages)
D:\ant\source\conf.jar
D:\ant\source\datasocket.jar
D:\ant\source\thirdparty\xercesImpl.jar

and I have created the follwoing build.xml

<?xml version="1.0"?>

<project name="Proj" default="compile" basedir=".">
<property name="name" value="Proj" />
<property name="build" value="${basedir}\build" />
<property name="source" value="${basedir}\source" />
<property name="baselib" value="\source" />

<target name="compile">
<javac srcdir="${source}" destdir="${build}">
<classpath>

<pathelement location="${baselib}\mysql-connector-java-3.0.6-stable-bin.jar" />
<pathelement location="${baselib}\photos.jar" />
<pathelement location="${baselib}\conf.jar" />
<pathelement location="${baselib}\jh.jar" />
<pathelement location="${baselib}\jhall.jar" />
<pathelement location="${baselib}\jhbasic.jar" />
<pathelement location="${baselib}\jhsearch.jar" />
<pathelement location="${baselib}\datasocket.jar" />
<pathelement location="${baselib}\log4j-1.2.7.jar" />
<pathelement location="${baselib}\thirdparty\xercesImpl.jar" />
<pathelement location="${baselib}\thirdparty\xmlParserAPIs.jar" />


</classpath>
</javac>
</target>

</project>

But when i try to execute it, i get errors which indicate that java files cannot find the jar files that is some problem with the classpath.

[javac] D:\ant\source\src\com\pack1\pack2\Test.java
143: cannot resolve symbol
[javac] symbol : class Logger
[javac] location: class com\pack1\pack2\Test.java
[javac] private Logger logger = Logger.getLogger(Test.class);
...
[ August 15, 2004: Message edited by: Thomas Greene ]
 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Specify your file paths using a forward slash (/).
You have used an absolute path for ${baselib}.

Execute with the -v option and you will see where you have gone wrong with the verbose output.
 
Thomas Greene
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tried changing slashes doesn't help.
With -v option I am only getting file does not exist
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic