You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Sebastian Redl <wa...@gmx.net> on 2004/10/16 15:40:15 UTC

Ant 1.6.2 failing to bootstrap

Hi

This is a rather peculiar problem. I'm running a Gentoo Linux 
installation and am trying to upgrade to Ant 1.6.2. I'm not 100% sure if 
this is a problem of Ant or Gentoo, but I tried everything outside Ant I 
know, so I'm finally posting here.
The Gentoo Ant installation process is split up into ant-core and 
various task steps. ant-core first compiles a core Ant manually, then 
uses it to run build.xml -> bootstrap.
The latter step fails, claiming that it can't find the compiler 
(com.sun.tools.javac.Main).
The compiler is correctly installed on my system, under
/opt/blackdown-jdk-1.4.1/lib/tools.jar
which is in my classpath AND is correctly found by Ant's bootstrap.sh 
(so it actually ends up in the classpath twice, but nothing changes if I 
remove one occurrence). JAVA_HOME points at /opt/blackdown-jdk-1.4.1
Diagnostic output of Ant shows that tools.jar is correctly listed in the 
classpath. Likewise, running Ant in the debugger and executing the 
classpath command also correctly lists the jar.
Running javac on the command line works.
An unzip listing of tools.jar shows that com/sun/tools/javac/Main.class 
exists and is in the correct place.
Bottom line: I'm out of ideas what could cause the problem. Everything, 
everyone but Ant finds the compiler. Ant doesn't.
Could there be any ClassLoader issues?

Thanks in advance
Sebastian Redl

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant 1.6.2 failing to bootstrap

Posted by Sebastian Redl <wa...@gmx.net>.
Laconia Data Systems wrote:

>Sounds like you have an adapter missing..this solution works when compiling
>ANT scripts within Eclipse:
>add the following property before compiling:
><property name="build.compiler"
>value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
>Martin-
>
>  
>
No, I've debugged into Ant and it's simply that this statement:
Class.forName("com.sun.tools.javac.Main");
throws a ClassNotFoundException. Then it does the same for Ant's attempt 
with a different class loader. (this.getClass().getClassLoader() within 
CompilerAdapterFactory.)

I'm compiling from a clean source tar.gz - the probability of the 
Javac13 adapter missing is rather low, anyway.

Sebastian

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant 1.6.2 failing to bootstrap

Posted by Sebastian Redl <wa...@gmx.net>.
Laconia Data Systems wrote:

>Make sure ANT_HOME is set to installed location of ANT
>  
>
check

>$ANT_HOME/bin is on your path
>  
>
check

>make sure JAVA_HOME is set to installed location og JDK
>  
>
check

>then..
>set environment variable ANT_OPTS
>= -Dbuild.compiler=com.sun.tools.javac.Main
>if that doesnt work not why not use jikes ?
>compiler can be obtained at http://www-124.ibm.com/developerworks/oss/jikes/
>ANT_OPTS = -Dbuild.compiler=jikes
>  
>
Done. That works indeed. Still, seems a little bit like a hack to me. 
I'd love to know why Ant can't find the compiler.

Thanks
Sebastian Redl

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant 1.6.2 failing to bootstrap

Posted by Laconia Data Systems <we...@laconiadatasystems.com>.
Make sure ANT_HOME is set to installed location of ANT
$ANT_HOME/bin is on your path
make sure JAVA_HOME is set to installed location og JDK
then..
set environment variable ANT_OPTS
= -Dbuild.compiler=com.sun.tools.javac.Main
if that doesnt work not why not use jikes ?
compiler can be obtained at http://www-124.ibm.com/developerworks/oss/jikes/
ANT_OPTS = -Dbuild.compiler=jikes
Martin-

----- Original Message -----
From: "Sebastian Redl" <wa...@gmx.net>
To: "Ant Users List" <us...@ant.apache.org>
Sent: Saturday, October 16, 2004 10:36 AM
Subject: Re: Ant 1.6.2 failing to bootstrap


> Laconia Data Systems wrote:
>
> >Sounds like you have an adapter missing..this solution works when
compiling
> >ANT scripts within Eclipse:
> >add the following property before compiling:
> ><property name="build.compiler"
> >value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
> >Martin-
> >
> >
> I don't think so. It's attempting to use the standard compiler, and the
> line that fails in CompilerAdapterFactory.java is just:
> Class.forName(MODERN_COMPILER);
> where MODERN_COMPILER is defined to be "com.sun.tools.javac.Main".
>
> Besides, modifying build files is not an option. This problem occurs
> with every project that uses Ant, including Ant itself.
>
> Sebastian Redl
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant 1.6.2 failing to bootstrap

Posted by Sebastian Redl <wa...@gmx.net>.
Laconia Data Systems wrote:

>Sounds like you have an adapter missing..this solution works when compiling
>ANT scripts within Eclipse:
>add the following property before compiling:
><property name="build.compiler"
>value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
>Martin-
>  
>
I don't think so. It's attempting to use the standard compiler, and the 
line that fails in CompilerAdapterFactory.java is just:
Class.forName(MODERN_COMPILER);
where MODERN_COMPILER is defined to be "com.sun.tools.javac.Main".

Besides, modifying build files is not an option. This problem occurs 
with every project that uses Ant, including Ant itself.

Sebastian Redl

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant 1.6.2 failing to bootstrap

Posted by Laconia Data Systems <we...@laconiadatasystems.com>.
Sounds like you have an adapter missing..this solution works when compiling
ANT scripts within Eclipse:
add the following property before compiling:
<property name="build.compiler"
value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
Martin-

----- Original Message -----
From: "Sebastian Redl" <wa...@gmx.net>
To: <us...@ant.apache.org>
Sent: Saturday, October 16, 2004 9:40 AM
Subject: Ant 1.6.2 failing to bootstrap


> Hi
>
> This is a rather peculiar problem. I'm running a Gentoo Linux
> installation and am trying to upgrade to Ant 1.6.2. I'm not 100% sure if
> this is a problem of Ant or Gentoo, but I tried everything outside Ant I
> know, so I'm finally posting here.
> The Gentoo Ant installation process is split up into ant-core and
> various task steps. ant-core first compiles a core Ant manually, then
> uses it to run build.xml -> bootstrap.
> The latter step fails, claiming that it can't find the compiler
> (com.sun.tools.javac.Main).
> The compiler is correctly installed on my system, under
> /opt/blackdown-jdk-1.4.1/lib/tools.jar
> which is in my classpath AND is correctly found by Ant's bootstrap.sh
> (so it actually ends up in the classpath twice, but nothing changes if I
> remove one occurrence). JAVA_HOME points at /opt/blackdown-jdk-1.4.1
> Diagnostic output of Ant shows that tools.jar is correctly listed in the
> classpath. Likewise, running Ant in the debugger and executing the
> classpath command also correctly lists the jar.
> Running javac on the command line works.
> An unzip listing of tools.jar shows that com/sun/tools/javac/Main.class
> exists and is in the correct place.
> Bottom line: I'm out of ideas what could cause the problem. Everything,
> everyone but Ant finds the compiler. Ant doesn't.
> Could there be any ClassLoader issues?
>
> Thanks in advance
> Sebastian Redl
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant 1.6.2 failing to bootstrap

Posted by Sebastian Redl <wa...@gmx.net>.
Christian Ashby wrote:

>> Bottom line: I'm out of ideas what could cause the problem. Everything,
>> everyone but Ant finds the compiler. Ant doesn't.
>> Could there be any ClassLoader issues?
>
>
> First check. Does 'java-config -Jc' give you the correct output 
> (should be location of java, and then that of javac' ?
>
> If not, try unmerging & remerging the JDK, or using the Sun 1.4.2 JDK 
> (at least to test) instead.

Gives me correct output, except that the java it refers to is not in the 
jre subdirectory. But since both exist...

I've managed to get ant-core to compile by manually forcing ant to use 
extJavac as compiler, but that's no long-term solution, as it would mean 
manually doing every ebuild that uses Java.
Unless there is a way of globally setting the build.compiler property of 
Ant?

Sebastian Redl

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Ant 1.6.2 failing to bootstrap

Posted by Christian Ashby <an...@cashby.me.uk>.
> Bottom line: I'm out of ideas what could cause the problem. Everything,
> everyone but Ant finds the compiler. Ant doesn't.
> Could there be any ClassLoader issues?

First check. Does 'java-config -Jc' give you the correct output (should be 
location of java, and then that of javac' ?

If not, try unmerging & remerging the JDK, or using the Sun 1.4.2 JDK (at 
least to test) instead.

Christian Ashby
Spiralinks, Inc.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org