Unable to invoke javac for rake ant tasks

Hi,

I’ve encountered a weird problem when using javac via rake’s ant
integration in 1.5 on Ubuntu 10.04. Despite setting JAVA_HOME and
ANT_HOME I get:

rake aborted!
org.apache.tools.ant.BuildException: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to “/usr/lib/jvm/java-6-openjdk/jre”

The JAVA_HOME is not the one I specified “/usr/lib/jvm/default-java”.

I think java, rake or ant is creating a classpath by taking the real
path of the java executable, the jdk version is a symlink to the jre
version, and stepping back a directory. Which lands it in the JRE not
the JDK and it breaks.

I can fix it by adding $JAVA_HOME/lib/tools.jar to the CLASSPATH but it
feels like something is wrong.

It works fine under OSX.

 Chris

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I’m guessing that because we’re not executing the “ant” startup
script, the tools jar isn’t getting added to the classpath for us.
Putting it in classpath is probably fine, but maybe we can figure out
ant’s logic for doing that and do the same thing?

File a bug for this and maybe poke around the ant script (vi which ant) and we can try to improve how we handle the tools.jar issue.

On Mon, Jun 7, 2010 at 10:00 AM, Christopher Bayliss
[email protected] wrote:

It is currently set to “/usr/lib/jvm/java-6-openjdk/jre”


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

As Charlie says, the tools.jar is not added to the classpath. We use
“ant
-diagnostics” to grab the classpath jars but tools.jar is not listed
there.
The ant scripts adds it before starting up:

if [ -f “$JAVA_HOME/lib/tools.jar” ] ; then

LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/tools.jar"

fi

Please Chris, file a bug and I’ll submit a patch for it.

Thank you!

On Mon, Jun 7, 2010 at 7:41 PM, Charles Oliver N.

On 07/06/10 22:19, David C. wrote:

Hi,

I’ve copied the behaviour of the ant script and just pushed a patch in
master,�4ac3a7

JRuby head’s rake now works as expected thanks.

    fi


Please�Chris,�file a bug and I'll submit a patch for it.

Bug filed JRUBY-4856

 Chris

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi,

I’ve copied the behaviour of the ant script and just pushed a patch in
master, 4ac3a7