Hi,

I'm having problems getting Ant 1.4.1 to work with JDK 1.4 beta3.
I get the 'Cannot use classic compiler' error:

[seb@ART002001] 150 # ant compile
Buildfile: build.xml

init:

compile:
    [javac] Modern compiler is not available - using classic compiler
    [javac] Compiling 11 source files to H:\dev\java\obj

BUILD FAILED

H:\dev\java\build.xml:14: Cannot use classic compiler, as it is not available A common solution is to set the environment variable JAVA_HOME to your jdk directory.

Total time: 3 seconds
Exit 1
 

I looked this up in the archives, and it seems other people had this problem, but the solution was always adding tools.jar to the classpath (or setting up JAVA_HOME correctly). I however think these things are fine, and running ant in debug mode seems to confirm this:

Mon 03/12/01 18:55 H:/dev/java
[seb@ART002001] 151 # ant -debug compile |& less
Ant version 1.4 compiled on September 3 2001
Buildfile: build.xml
Setting project property: ant.java.version -> 1.4
Detected Java version: 1.4 in: s:\soft\win-ix86\j2sdk\1.4.0b3\jre
Detected OS: Windows 2000
 +User task: tar     org.apache.tools.ant.taskdefs.Tar
 +User task: fail     org.apache.tools.ant.taskdefs.Exit
[...]
Setting project property: java.specification.version -> 1.4
Setting project property: java.class.path -> s:\soft\common\ant\1.4.1\lib\optional.jar;s:\soft\common\ant\1.4.1\lib\jaxp.jar;s:\soft\common\ant\1.4.1\lib\crimson.jar;s:\soft\common\ant\1.4.1\lib\ant.jar;s:\soft\win-ix86\j2sdk\1.4.0b3\lib;s:\soft\win-ix86\j2sdk\1.4.0b3\lib\tools.jar;s:\soft\win-ix86\j2sdk\1.4.0b3\lib\tools.jar
Setting project property: user.name -> seb
Setting project property: java.vm.specification.version -> 1.0
Setting project property: java.home -> s:\soft\win-ix86\j2sdk\1.4.0b3\jre
[...]

BUILD FAILED

H:\dev\java\build.xml:14: Cannot use classic compiler, as it is not available A common solution is to set the environment variable JAVA_HOME to your jdk directory.
        at org.apache.tools.ant.taskdefs.compilers.Javac12.execute(Javac12.java:96)
        at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:530)
        at org.apache.tools.ant.Task.perform(Task.java:217)
        at org.apache.tools.ant.Target.execute(Target.java:164)
        at org.apache.tools.ant.Target.performTasks(Target.java:182)
        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)

(Note the java.class.path). This happens though:

Mon 03/12/01 18:57 H:/dev/java
[seb@ART002001] 152 # ls -l s:/soft/win-ix86/j2sdk/1.4.0b3/lib/tools.jar
-rw-r--r--   1 administ None      4822168 Dec  3 14:44 s:/soft/win-ix86/j2sdk/1.4.0b3/lib/tools.jar

Mon 03/12/01 18:58 H:/dev/java
[seb@ART002001] 154 # jar tvf s:/soft/win-ix86/j2sdk/1.4.0b3/lib/tools.jar sun/tools/javac/Main.class
 13253 Sat Oct 20 01:16:08 PDT 2001 sun/tools/javac/Main.class

So i don't really understand what's wrong here, unless Ant 1.4.1 has an issue with the Sun 1.4 beta 3 SDK?

Any help would be appreciated!

Sebastien.