Unfortunately the behavior isn't the same. Here is the output from ANT showing that the directory is in the classpath.
--Dan ============================ Buildfile: build.xml Detected Java version: 1.3 in: C:\Java\jdk1.3\jre Detected OS: Windows 2000 parsing buildfile C:\Working\ant_javac\build.xml with URI = file:C:/Working/ant_javac/build.xml Project base dir set to: C:\Working\ant_javac Build sequence for target `all' is [all] Complete build sequence is [all] all: [javac] Dan.java added as C:\Working\ant_javac\dan\Dan.class doesn't exist. [javac] Compiling 1 source file [javac] Using modern compiler [javac] Compilation args: -classpath C:\Working\ant_javac\alex;C:\Java\jdk1.3\lib\tools.jar;C:\Java\jakarta-ant-1.4.1\lib\jaxp.jar;C:\Java\jakarta-ant-1.4.1\lib\jakarta-ant-1.4.1-optional.jar;C:\Java\jakarta-ant-1.4.1\lib\crimson.jar;C:\Java\jakarta-ant-1.4.1\lib\ant.jar -sourcepath C:\Working\ant_javac\dan -g:none [javac] File to be compiled: C:\Working\ant_javac\dan\Dan.java [javac] C:\Working\ant_javac\dan\Dan.java:1: cannot resolve symbol [javac] symbol: class Alex [javac] import Alex; [javac] ^ [javac] C:\Working\ant_javac\dan\Dan.java:7: cannot resolve symbol [javac] symbol : variable Alex [javac] location: class Dan [javac] System.out.println(Alex.CONSTANT); [javac] ^ [javac] 2 errors BUILD FAILED C:\Working\ant_javac\build.xml:4: Compile failed, messages should have been provided. at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:559) at org.apache.tools.ant.Task.perform(Task.java:217) at org.apache.tools.ant.Target.execute(Target.java:184) at org.apache.tools.ant.Target.performTasks(Target.java:202) at org.apache.tools.ant.Project.executeTarget(Project.java:601) at org.apache.tools.ant.Project.executeTargets(Project.java:560) at org.apache.tools.ant.Main.runBuild(Main.java:454) at org.apache.tools.ant.Main.start(Main.java:153) at org.apache.tools.ant.Main.main(Main.java:176) Total time: 1 second -----Original Message----- From: Laurie Harper [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 5:44 PM To: Ant Users List Subject: Re: javac task: referencing dependent classes The javac task works by calling javac so it's behaviour should be the same. Check that your Ant build file is setting up the classpath correctly and you shold be fine. L. On 9/17/02 6:38 PM, "Daniel L. Boxwell" <[EMAIL PROTECTED]> wrote: > I have run into a problem using the javac task in both ANT 1.4.1 and 1.5 using > both jdk1.3.1 and jdk1.4. It seems as though the ANT javac task is unable to > include files in the classpath unless they are already compiled. > > When running javac from the command line, it is possible to include > directories in the classpath that contain uncompiled source (.java) files. > Let's say that the file I am trying to compile with javac depends on one of > these referenced .java files. javac.exe has no trouble compiling the dependent > files and then building the original target. > > The ANT javac task; however, is unable to reference files in this manner. The > dependent files MUST be compiled in advance. This becomes a problem when > trying to deal with circular dependencies within your build. I have included > the simplest of examples in the attached zip file. See how the .bat file that > calls javac has no trouble - then delete the generated class files and try the > ant build. If you leave the generated files, then ant has no problem!! > > This is a simple example, but my problem is much larger: I have a large > development team - each with their own jar file. In the end I want to build > all of the jars at once using a separate invocation of javac, but dependencies > will make this difficult. It would be nice to include all the various src > directories in the classpath of each javac invocation so javac will just hunt > for the dependent files itself. > > If anybody has a better solution to my problem, I am willing to entertain it, > but it seems to me that the javac task should work the same way as javac does. > > Thanks in advance, > > --Dan > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>