Login  Register

Access to java compiler in Linux

Posted by JiHO-2 on Jun 09, 2009; 11:06pm
URL: http://imagej.273.s1.nabble.com/Access-to-java-compiler-in-Linux-tp3692106.html

Hello everyone,

I am trying to get ImageJ to compile a plugin on Linux and cannot find  
how to set my Java environment properly.

I start ImageJ from the command line with something like:
         java -jar ij.jar -ijpath path/to/plugins/

When I try to compile my plugin I get a message saying:
         "This JVM does not include the javac compiler
         ...
         [OK]
         "
while it does:
         $ which javac
         /usr/bin/javac

         $ readlink -f $(which javac)
         /usr/lib/jvm/java-6-sun-1.6.0.13/bin/javac
This installation is Sun's Java on Ubuntu.

When I start ImageJ with an explicit classpath
         java -cp /usr/lib/jvm/java-6-sun-1.6.0.13/lib/
tools.jar:ij.jar ij.ImageJ -ijpath path/to/plugins/
it works.

But I would prefer if it worked with a simple command line and by  
setting environment variables (the code in which I call ImageJ should  
work cross platform when the user set's the environment correctly).  
Setting
         JAVA_HOME to /usr/lib/jvm/java-6-sun-1.6.0.13/
         CLASSPATH to /usr/lib/jvm/java-6-sun-1.6.0.13/lib
or even
         CLASSPATH to /usr/lib/jvm/java-6-sun-1.6.0.13/lib/tools.jar
and using
         java -jar ij.jar -ijpath path/to/plugins/
or
         java -cp ij.jar ij.ImageJ -ijpath path/to/plugins/
does not work.

Could someone point me towards the correct configuration please?

PS: as a side note, is there a way to compile plugins on the command  
line, outside of ImageJ.

Thanks in advance.

JiHO
---
http://jo.irisson.free.fr/