Some question regarding this error message ("Modern compiler not available"): How exactly does Ant determine no 'modern' compiler is available? My compiler _is_ modern, and the error message and debugging info don't provide me enough info to correct the problem.

I have this error on my Win2k box, with several versions of Ant, several versions of JDK's, each time with a correct JAVA_HOME and a lib/tools.jar in it.

More detailed info below.

thanks in advance,
Sebastien.

---------------------------

[Detailed info for JDK 1.3.1_01 / Ant 1.4 (also tried other combinations with JDK 1.4.1 and Ant 1.4.1): ]

D:\temp\test>echo %JAVA_HOME%
d:\soft\win-ix86\jdk\1.3.1_01

D:\temp\test>echo %CLASSPATH%
d:\soft\win-ix86\jdk\1.3.1_01\lib\tools.jar

D:\temp\test>rem (also tried without this classpath)

D:\temp\test>dir %CLASSPATH%
 Volume in drive D is soft
 Volume Serial Number is D478-F8F7

 Directory of d:\soft\win-ix86\jdk\1.3.1_01\lib

08/08/2001  01:14p           4,710,905 tools.jar
               1 File(s)      4,710,905 bytes
               0 Dir(s)     592,420,864 bytes free

D:\temp\test>dir
 Volume in drive D is soft
 Volume Serial Number is D478-F8F7

 Directory of D:\temp\test

12/04/2001  05:25p      <DIR>          .
12/04/2001  05:25p      <DIR>          ..
12/04/2001  05:05p                 303 build-compile.xml
12/04/2001  04:54p                 250 build-compile.xml~
12/04/2001  05:21p              14,512 out
12/04/2001  05:24p              10,693 out2.bat
12/04/2001  05:28p               9,224 stdout
12/04/2001  03:39p                   7 test.class
12/04/2001  03:39p                  23 test.java
               7 File(s)         35,012 bytes
               2 Dir(s)     592,420,864 bytes free

D:\temp\test>type build-compile.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="test-compile" default="compile" basedir=".">

  <target name="compile">
    <javac srcdir="." destdir="." debug="on">
      <include name="*.java"/>
    </javac>
  </target>

</project>

D:\temp\test>ant -f build-compile.xml
Buildfile: build-compile.xml

compile:
    [javac] Modern compiler is not available - using classic compiler
    [javac] Compiling 1 source file to D:\temp\test

BUILD FAILED

D:\temp\test\build-compile.xml:5: Cannot use classic compiler, as it is not avai
lable A common solution is to set the environment variable JAVA_HOME to your jdk
 directory.

Total time: 0 seconds

D:\temp\test>ant -debug -f build-compile.xml
Ant version 1.4 compiled on September 3 2001
Buildfile: build-compile.xml
Setting project property: ant.java.version -> 1.3
Detected Java version: 1.3 in: d:\soft\win-ix86\jdk\1.3.1_01\jre
Detected OS: Windows 2000
 +User task: tar     org.apache.tools.ant.taskdefs.Tar
 +User task: fail     org.apache.tools.ant.taskdefs.Exit
 +User task: uptodate     org.apache.tools.ant.taskdefs.UpToDate
 +User task: dependset     org.apache.tools.ant.taskdefs.DependSet
 +User task: java     org.apache.tools.ant.taskdefs.Java
 +User task: execon     org.apache.tools.ant.taskdefs.ExecuteOn
 +User task: echo     org.apache.tools.ant.taskdefs.Echo
 +User task: chmod     org.apache.tools.ant.taskdefs.Chmod
 +User task: javadoc2     org.apache.tools.ant.taskdefs.Javadoc
 +User task: deltree     org.apache.tools.ant.taskdefs.Deltree
 +User task: cvs     org.apache.tools.ant.taskdefs.Cvs
 +User task: tstamp     org.apache.tools.ant.taskdefs.Tstamp
 +User task: pathconvert     org.apache.tools.ant.taskdefs.PathConvert
 +User task: unjar     org.apache.tools.ant.taskdefs.Expand
 +User task: patch     org.apache.tools.ant.taskdefs.Patch
 +User task: mail     org.apache.tools.ant.taskdefs.SendEmail
 +User task: gzip     org.apache.tools.ant.taskdefs.GZip
 +User task: copy     org.apache.tools.ant.taskdefs.Copy
 +User task: filter     org.apache.tools.ant.taskdefs.Filter
 +User task: jar     org.apache.tools.ant.taskdefs.Jar
 +User task: unzip     org.apache.tools.ant.taskdefs.Expand
 +User task: rename     org.apache.tools.ant.taskdefs.Rename
 +User task: copyfile     org.apache.tools.ant.taskdefs.Copyfile
 +User task: gunzip     org.apache.tools.ant.taskdefs.GUnzip
 +User task: antcall     org.apache.tools.ant.taskdefs.CallTarget
 +User task: taskdef     org.apache.tools.ant.taskdefs.Taskdef
 +User task: mkdir     org.apache.tools.ant.taskdefs.Mkdir
 +User task: sql     org.apache.tools.ant.taskdefs.SQLExec
 +User task: replace     org.apache.tools.ant.taskdefs.Replace
 +User task: ear     org.apache.tools.ant.taskdefs.Ear
 +User task: ant     org.apache.tools.ant.taskdefs.Ant
 +User task: style     org.apache.tools.ant.taskdefs.XSLTProcess
 +User task: fixcrlf     org.apache.tools.ant.taskdefs.FixCRLF
 +User task: sequential     org.apache.tools.ant.taskdefs.Sequential
 +User task: genkey     org.apache.tools.ant.taskdefs.GenerateKey
 +User task: zip     org.apache.tools.ant.taskdefs.Zip
 +User task: condition     org.apache.tools.ant.taskdefs.ConditionTask
 +User task: antstructure     org.apache.tools.ant.taskdefs.AntStructure
 +User task: javac     org.apache.tools.ant.taskdefs.Javac
 +User task: typedef     org.apache.tools.ant.taskdefs.Typedef
 +User task: available     org.apache.tools.ant.taskdefs.Available
 +User task: cvspass     org.apache.tools.ant.taskdefs.CVSPass
 +User task: move     org.apache.tools.ant.taskdefs.Move
 +User task: signjar     org.apache.tools.ant.taskdefs.SignJar
 +User task: property     org.apache.tools.ant.taskdefs.Property
 +User task: unwar     org.apache.tools.ant.taskdefs.Expand
 +User task: touch     org.apache.tools.ant.taskdefs.Touch
 +User task: get     org.apache.tools.ant.taskdefs.Get
 +User task: javadoc     org.apache.tools.ant.taskdefs.Javadoc
 +User task: record     org.apache.tools.ant.taskdefs.Recorder
 +User task: untar     org.apache.tools.ant.taskdefs.Untar
 +User task: delete     org.apache.tools.ant.taskdefs.Delete
 +User task: copydir     org.apache.tools.ant.taskdefs.Copydir
 +User task: war     org.apache.tools.ant.taskdefs.War
 +User task: parallel     org.apache.tools.ant.taskdefs.Parallel
 +User task: exec     org.apache.tools.ant.taskdefs.ExecTask
 +User task: apply     org.apache.tools.ant.taskdefs.Transform
 +User task: sleep     org.apache.tools.ant.taskdefs.Sleep
 +User task: rmic     org.apache.tools.ant.taskdefs.Rmic
 +User datatype: fileset     org.apache.tools.ant.types.FileSet
 +User datatype: patternset     org.apache.tools.ant.types.PatternSet
 +User datatype: filterset     org.apache.tools.ant.types.FilterSet
 +User datatype: filelist     org.apache.tools.ant.types.FileList
 +User datatype: description     org.apache.tools.ant.types.Description
 +User datatype: path     org.apache.tools.ant.types.Path
 +User datatype: mapper     org.apache.tools.ant.types.Mapper
Setting project property: java.runtime.name -> Java(TM) 2 Runtime Environment, S
tandard Edition
Setting project property: sun.boot.library.path -> d:\soft\win-ix86\jdk\1.3.1_01
\jre\bin
Setting project property: java.vm.version -> 1.3.1_01
Setting project property: java.vm.vendor -> Sun Microsystems Inc.
Setting project property: java.vendor.url -> http://java.sun.com/
Setting project property: path.separator -> ;
Setting project property: java.vm.name -> Java HotSpot(TM) Client VM
Setting project property: file.encoding.pkg -> sun.io
Setting project property: java.vm.specification.name -> Java Virtual Machine Spe
cification
Setting project property: user.dir -> D:\temp\test
Setting project property: java.runtime.version -> 1.3.1_01
Setting project property: java.awt.graphicsenv -> sun.awt.Win32GraphicsEnvironme
nt
Setting project property: os.arch -> x86
Setting project property: java.io.tmpdir -> D:\TEMP\
Setting project property: line.separator ->

Setting project property: java.vm.specification.vendor -> Sun Microsystems Inc.
Setting project property: java.awt.fonts ->
Setting project property: os.name -> Windows 2000
Setting project property: ant.home -> d:\soft\win-ix86\jakarta-ant-1.4\bin\\..
Setting project property: java.library.path -> d:\soft\win-ix86\jdk\1.3.1_01\bin
;.;C:\WINNT\System32;C:\WINNT;d:\soft\win-ix86\jakarta-ant-1.4\bin;d:\soft\win-i
x86\jdk\1.3.1_01\bin;C:\Winnt;C:\winnt\system32
Setting project property: java.specification.name -> Java Platform API Specifica
tion
Setting project property: java.class.version -> 47.0
Setting project property: os.version -> 5.0
Setting project property: user.home -> C:\Documents and Settings\seb
Setting project property: user.timezone ->
Setting project property: java.awt.printerjob -> sun.awt.windows.WPrinterJob
Setting project property: file.encoding -> Cp1252
Setting project property: java.specification.version -> 1.3
Setting project property: java.class.path -> d:\soft\win-ix86\jdk\1.3.1_01\lib\t
ools.jar;d:\soft\win-ix86\jakarta-ant-1.4\bin\\..\lib\jaxp.jar;d:\soft\win-ix86\
jakarta-ant-1.4\bin\\..\lib\crimson.jar;d:\soft\win-ix86\jakarta-ant-1.4\bin\\..
\lib\ant.jar;d:\soft\win-ix86\jdk\1.3.1_01\lib\tools.jar
Setting project property: user.name -> seb
Setting project property: java.vm.specification.version -> 1.0
Setting project property: java.home -> d:\soft\win-ix86\jdk\1.3.1_01\jre
Setting project property: user.language -> en
Setting project property: java.specification.vendor -> Sun Microsystems Inc.
Setting project property: awt.toolkit -> sun.awt.windows.WToolkit
Setting project property: java.vm.info -> mixed mode
Setting project property: java.version -> 1.3.1_01
Setting project property: java.ext.dirs -> d:\soft\win-ix86\jdk\1.3.1_01\jre\lib
\ext
Setting project property: sun.boot.class.path -> d:\soft\win-ix86\jdk\1.3.1_01\j
re\lib\rt.jar;d:\soft\win-ix86\jdk\1.3.1_01\jre\lib\i18n.jar;d:\soft\win-ix86\jd
k\1.3.1_01\jre\lib\sunrsasign.jar;d:\soft\win-ix86\jdk\1.3.1_01\jre\classes
Setting project property: java.vendor -> Sun Microsystems Inc.
Setting project property: file.separator -> \
Setting project property: java.vendor.url.bug -> http://java.sun.com/cgi-bin/bug
report.cgi
Setting project property: sun.io.unicode.encoding -> UnicodeLittle
Setting project property: sun.cpu.endian -> little
Setting project property: user.region -> US
Setting project property: sun.cpu.isalist -> pentium i486 i386
Setting ro project property: ant.version -> Ant version 1.4 compiled on Septembe
r 3 2001
Setting ro project property: ant.file -> D:\temp\test\build-compile.xml
parsing buildfile D:\temp\test\build-compile.xml with URI = file:D:/temp/test/bu
ild-compile.xml
Setting ro project property: ant.project.name -> test-compile
Adding reference: test-compile -> org.apache.tools.ant.Project@37c60d
Setting project property: basedir -> D:\temp\test
Project base dir set to: D:\temp\test
 +Target: compile
   +Task: javac
Build sequence for target `compile' is [compile]
Complete build sequence is [compile]

compile:
FileSet: Setup file scanner in dir D:\temp\test with patternSet{ includes: [*.ja
va] excludes: [] }
    [javac] test.java added as D:\temp\test\test.class is outdated.
    [javac] Modern compiler is not available - using classic compiler
    [javac] Compiling 1 source file to D:\temp\test
    [javac] Using classic compiler
    [javac] Compilation args: -d D:\temp\test -classpath D:\temp\test;D:\soft\wi
n-ix86\jdk\1.3.1_01\lib\tools.jar;D:\soft\win-ix86\jakarta-ant-1.4\lib\jaxp.jar;
D:\soft\win-ix86\jakarta-ant-1.4\lib\crimson.jar;D:\soft\win-ix86\jakarta-ant-1.
4\lib\ant.jar -sourcepath D:\temp\test -g
    [javac] File to be compiled:
    D:\temp\test\test.java
 

BUILD FAILED

D:\temp\test\build-compile.xml:5: Cannot use classic compiler, as it is not avai
lable 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)

Total time: 2 seconds