You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Mike Kozlowski <mk...@gmrmarketing.com> on 2001/03/01 21:51:10 UTC

"Cannot use classic compiler, as it is not available" problem

I've installed Ant 1.2 on a Red Hat Linux system, using the binary
from the Ant web site.  The error message I'm getting is apparently a
typical one:

 Cannot use classic compiler, as it is not available

I looked through the archives for the mailing list, and followed the
tips I found there (add tools.jar to the CLASSPATH; make sure you've
got the environment variables set; make sure ant.jar isn't in the
jre/lib/ext directory; make sure ant.jar is in your CLASSPATH; make
sure the 'java' that's getting run is the same one that belongs to the
JAVA_HOME) all to no avail.  

Any help?  I've included more detailed information below.

Here's the relevant snippet from setenv:
 
CLASSPATH=/usr/local/jdk-1.2.2/lib/tools.jar:/usr/local/mysql/lib/mm.mysql.jdbc-1.2b/:/usr/local/apache/libexec/ApacheJServ.jar:/usr/local/JSDK2.0/lib/jsdk.jar:.
ANT_HOME=/usr/local/ant
JAVA_HOME=/usr/local/jdk-1.2.2

(I added the tools.jar after reading the mailing list archive; ant
didn't work without it, either.)

Here's the build.xml file:

<project name="extranet" default="compile">
  <property name="src" value="." />
  <property name="build" value="build" />

  <target name="prepare">
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}" />
  </target>

  <target name="compile" depends="prepare">
    <javac srcdir="${src}" destdir="${build}"/>
  </target>

  <target name="clean">
    <!-- Delete the ${build} directory tree -->
    <delete dir="${build}" />
  </target>
</project>

Here's the output from ant -v:

Ant version 1.2 compiled on October 24 2000

Searching for build.xml ...
Searching in /home/mlk/cvswork/temp/extranet
Buildfile: /home/mlk/cvswork/temp/extranet/build.xml
Detected Java Version: 1.2
Detected OS: Linux
Project base dir set to: /home/mlk/cvswork/temp/extranet
Build sequence for target `compile' is [prepare, compile]
Complete build sequence is [prepare, compile, clean]
    [javac] Compiling 14 source files to /home/mlk/cvswork/temp/extranet/build
    [javac] Using classic compiler
    [javac] Compilation args: -d /home/mlk/cvswork/temp/extranet/build -classpath /home/mlk/cvswork/temp/extranet/build:/usr/local/mysql/lib/mm.mysql.jdbc-1.2b:/usr/local/apache/libexec/ApacheJServ.jar:/usr/local/JSDK2.0/lib/jsdk.jar:/home/mlk/cvswork/temp/extranet:/usr/local/ant/lib/ant.jar:/usr/local/ant/lib/jaxp.jar:/usr/local/ant/lib/parser.jar -sourcepath /home/mlk/cvswork/temp/extranet
    [javac] Files to be compiled:
    /home/mlk/cvswork/temp/extranet/ControllerServlet.java
    [and so forth -- edited for brevity]

BUILD FAILED

/home/mlk/cvswork/temp/extranet/build.xml:11: Cannot use classic compiler, as it is not available


-- 
Mike Kozlowski
mkozlowski@gmrmarketing.com


Re: "Cannot use classic compiler, as it is not available" problem

Posted by Mike Kozlowski <mk...@gmrmarketing.com>.
On 2 Mar 2001, Stefan Bodewig wrote:

> It doesn't look as if your CLASSPATH definition from above gets passed
> to Ant, otherwise tools.jar would be included in this -classpath
> argument for the javac task as well.
> 
> Could you add an <echo message="${java.class.path}" /> somewhere to
> see which CLASSPATH Ant has been invoked with?

I've managed to solve the problem:  While I was trying various things to
get it to work, I ran ant with the -debug flag, and noticed things that
looked odd in the properties that are displayed; sure enough, it turns out
that what I thought was a straight-up JDK 1.2.2 turned out to be a
"release candidate" from blackdown.org.  After installing the official Sun
JDK, the problems went away.

My thanks for the help.

-- 
Mike Kozlowski
mkozlowski@gmrmarketing.com


Re: "Cannot use classic compiler, as it is not available" problem

Posted by Stefan Bodewig <bo...@apache.org>.
Mike Kozlowski <mk...@gmrmarketing.com> wrote:

> CLASSPATH=/usr/local/jdk-1.2.2/lib/tools.jar:/usr/local/mysql/lib/mm.mysql.jdbc-1.2b/:/usr/local/apache/libexec/ApacheJServ.jar:/usr/local/JSDK2.0/lib/jsdk.jar:.
> 
> Here's the output from ant -v:

<snip />

> -classpath /home/mlk/cvswork/temp/extranet/build:/usr/local/mysql/lib/mm.mysql.jdbc-1.2b:/usr/local/apache/libexec/ApacheJServ.jar:/usr/local/JSDK2.0/lib/jsdk.jar:/home/mlk/cvswork/temp/extranet:/usr/local/ant/lib/ant.jar:/usr/local/ant/lib/jaxp.jar:/usr/local/ant/lib/parser.jar

It doesn't look as if your CLASSPATH definition from above gets passed
to Ant, otherwise tools.jar would be included in this -classpath
argument for the javac task as well.

Could you add an <echo message="${java.class.path}" /> somewhere to
see which CLASSPATH Ant has been invoked with?

Stefan