-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
It seems impossible to compile Java 1.5 source code (that is, Java code
using language features new to version 1.5) from within ImageJ, even
though ImageJ is running on Java 1.5 or 1.6 (according to its
Properties) and is pointed to the appropriate tools.jar; I have tried on
Linux and MacOS X, and made sure no other Java version was available on
the system.
Did I miss something, or is this a deliberate restriction on the
(depreciated) sun.tools.javac.Main compiler interface used by ImageJ ?
In the latter case, would it be possible to add support for the new
interface javax.tools.JavaCompiler introduced in version 1.6 to replace
the undocumented sun.tools.javac.Main ?
Adrian Daerr
minimal example code:
- ---- snip ----
import ij.plugin.PlugIn;
import ij.IJ;
// "import static" statement new since Java 1.5:
import static java.lang.Math.*;
class CompilerTest implements PlugIn {
public void run(String arg) {
IJ.log("sin(1)="+sin(1));// no Math. needed thanks to above
return;
}
}
- --- snip ----
Error message:
Note: sun.tools.javac.Main has been deprecated.
/Applications/ImageJ/plugins/Bricabrac/CompilerTest.java:4: Identifier
expected.
import static java.lang.Math.*;
^
/Applications/ImageJ/plugins/Bricabrac/CompilerTest.java:8: Method
sin(int) not found in class CompilerTest.
IJ.log("sin(1)="+sin(1));
^
2 errors, 1 warning
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla -
http://enigmail.mozdev.orgiD8DBQFGI5VDUKl/wQSyHWgRAoQBAJ9munEt6M21tpBm1JfKcNj9hTaviQCggP88
h8mwiwjHSv49f/XH7ShQssk=
=Nzq6
-----END PGP SIGNATURE-----