Login  Register

Re: Access to java compiler in Linux

Posted by ctrueden on Jun 16, 2009; 10:12pm
URL: http://imagej.273.s1.nabble.com/Access-to-java-compiler-in-Linux-tp3692106p3692115.html

Hi JiHO,


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

In general, with Java 1.6+ you should be able to use something like:

  javac -cp /path/to/ImageJ/ij.jar:/path/to/ImageJ/plugins/* My_Plugin.java

You may run into trouble if you have JAR dependencies in subfolders of
plugins, but if your build configuration is getting that complicated I
suggest you keep ij.jar somewhere as a separate dependency and build
everything totally outside the ImageJ directory structure. That's how we
build the LOCI plugins.

-Curtis

On Tue, Jun 9, 2009 at 6:06 PM, JiHO <[hidden email]> wrote:

> 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/
>