Paul Gregoire wrote:
I dont see anything obviously wrong with your env one minor change you might
want to consider is to place the %PATH% at the end of your PATH env
There was a mistake in that PATH. But that's not the problem, corrected it (to d:\soft\win-ix86\jakarta-ant-1.4\bin;d:\soft\win-ix86\jdk\1.3.1_01\bin;C:\Winnt;C:\winnt\system32), still the same thing.
variable. Also i construct my javac tasks like so..
I tried this but it doesn't help either.
I don't see why something as simple as:

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

doesn't work with any JDK version / Ant version i try. I used this many times before, only difference is that i know try this on a Windows platform, previously always linux.

I'll send this issue to the ant-dev mailing list, maybe someone has a clue how this modern / classic test is exactly implemented. The '-debug' option doesn't explain why no modern compiler is detected.

-seb.
 
 

 

 <path id="lib.path">
  <pathelement path="${env.CLASSPATH}" />
  <pathelement path="${env.LOCALCLASSPATH}" />
  <pathelement location="${build}" />
  <fileset dir="${build}" casesensitive="yes" >
       <include name="**/*.class"/>
  </fileset>
  <fileset dir="${ext}" casesensitive="no" >
   <include name="junit.jar" />
   <include name="ZKM.jar" />
   <include name="jdom.jar" />
   <include name="xerces.jar" />
  </fileset>
  <fileset dir="${dist.lib.path}" casesensitive="no" >
   <include name="**/*.jar"/>
  </fileset>
 </path>

<target .....

  <javac
   srcdir   = "${src}"
   destdir  = "${build}"
   includes = "**/*.java"
   excludes = "**/Test*.java"
   includeAntRuntime = "false"
   classpathref="lib.path"
  >
  </javac>

</target>

Some may call my lib.path overkill but it works great for me.. oh btw i dont
use JDK 1.4 yet so im no expert. :)

-----Original Message-----
From: Sebastien Boving [mailto:sebastien@cirquedigital.com]
Sent: Tuesday, December 04, 2001 3:50 PM
To: Ant Users List
Subject: Re: Ant 1.4.1 / JDK 1.4 beta3: '
 
 

Paul Gregoire wrote:

I thought i read "somewhere" that -classic was no longer supported with 1.4;

i noticed these items over at SUN..

Yes, but why doesn't the default 'modern' compiler work? I simply cannot get
any compilation to work. Not even with JDK 1.3.1!

I'm now running everything locally (Ant, JDK, *.java and build.xml), and in
a cmd.exe (instead of my cygwin tcsh which sometimes generates path
separation issues).

Take a look at the following and tell me if there's any check i'm
forgetting:

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

 Directory of D:\temp\test

12/04/2001  03:39p      <DIR>          .
12/04/2001  03:39p      <DIR>          ..
12/04/2001  03:29p                 283 build-compile.xml
12/04/2001  03:39p                  23 test.java
               3 File(s)            313 bytes
               2 Dir(s)     592,474,112 bytes free

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

D:\temp\test>echo %PATH%
$PATH;d:\soft\win-ix86\jakarta-ant-1.4\bin;d:\soft\win-ix86\jdk\1.3.1_01\bin
;

D:\temp\test>dir %JAVA_HOME%\lib\tools.jar
 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,474,112 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:6: 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.
 

The javac byte-code compiler has a new -source option that enables support
for compiling source code containing assertions. Also, default compilation
is for -target 1.2. Previously, the default was 1.1. The compiler now
correctly detects unreachable empty statements,

and

The Java virtual machines in this release include several enhancements.

Signal-chaining facility.
64-bit support on SolarisTM-SPARCTM platform edition.
Error-reporting mechanism.
New facility for logging garbage-collection events.
The Classic virtual machine is no longer shipped as part of the Java 2 SDK.

-----Original Message-----
From: Sebastien Boving [ mailto:sebastien@cirquedigital.com
<mailto:sebastien@cirquedigital.com> ]
Sent: Tuesday, December 04, 2001 2:41 PM
To: ant-user@jakarta.apache.org
Subject: Re: Ant 1.4.1 / JDK 1.4 beta3: '
 

Some more on this 'Modern compiler is not available / Cannot use classic
compiler' problem:

I've been trying Ant 1.4, and JDK 1.3.1_01, local installations iso having
these reside on a SMB server: always the same problem.
I do set JAVA_HOME properly, and setting CLASSPATH to tools.jar doesn't help

either. Building using a minimal build file still gives me the error
message.

If i run 'ant -debug', i do get tools.jar in 'java.class.path'.

There must be something very basic that's wrong (some other environment in
this machine / ...) on this Win2k machine.

tia,
Sebastien.
 

Sebastien Boving wrote:

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\an

t.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.