File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes help in setting classpath in ant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "help in setting classpath in ant" Watch "help in setting classpath in ant" New topic

help in setting classpath in ant

Thomas Greene
Ranch Hand

Joined: Aug 09, 2004
Posts: 127
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)

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}">

<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" />



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\
143: cannot resolve symbol
[javac] symbol : class Logger
[javac] location: class com\pack1\pack2\
[javac] private Logger logger = Logger.getLogger(Test.class);
[ August 15, 2004: Message edited by: Thomas Greene ]
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
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.

Tony Morris
Java Q&A (FAQ, Trivia)
Thomas Greene
Ranch Hand

Joined: Aug 09, 2004
Posts: 127
Tried changing slashes doesn't help.
With -v option I am only getting file does not exist
I agree. Here's the link:
subject: help in setting classpath in ant
It's not a secret anymore!