NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug.

The Fiji project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Bug 1012 - Compile and Run Command not currently supported in version 1.49p
Compile and Run Command not currently supported in version 1.49p
Status: RESOLVED WONTFIX
Product: Fiji
Classification: Unclassified
Component: Plugins
unspecified
Macintosh Mac OS
: P4 normal
Assigned To: ImageJ Bugs Mailing List
Depends on:
Blocks:
 
Reported: 2015-02-28 15:50 CST by Andres Lorente
Modified: 2015-03-01 23:08 CST
3 users (show)

See Also:

Description Andres Lorente 2015-02-28 15:50:19 CST
may things not working ... what happened?

Information about your version of Java:

  os.arch => x86_64
  os.name => Mac OS X
  os.version => 10.10.2
  java.version => 1.6.0_65
  java.vendor => Apple Inc.
  java.runtime.name => Java(TM) SE Runtime Environment
  java.runtime.version => 1.6.0_65-b14-466.1-11M4716
  java.vm.name => Java HotSpot(TM) 64-Bit Server VM
  java.vm.version => 20.65-b04-466.1
  java.vm.vendor => Apple Inc.
  java.vm.info => mixed mode
  java.awt.graphicsenv => apple.awt.CGraphicsEnvironment
  java.specification.name => Java Platform API Specification
  java.specification.version => 1.6
  sun.cpu.endian => little
  sun.desktop => null
  file.separator => /

The up-to-date check says: REMIND_LATER

Information relevant to JAVA_HOME related problems:

  JAVA_HOME is set to: null
  imagej.dir => /Applications/Fiji.app

Information about the version of each plugin:

Activated update sites:
ImageJ: http://update.imagej.net/ (last check:20150226133217)
Fiji: http://fiji.sc/update/ (last check:20150226133401)
Cookbook: http://sites.imagej.net/Cookbook/ (last check:20131220171857)

Files not up-to-date:
  447e713b (MODIFIED) 20150228152343 Contents/Info.plist
  b0038cbf (MODIFIED) 20150228152753 jars/ij-1.49m.jar
  1ad3be0d (LOCAL_ONLY) 20140802105812 jars/jpedalSTD.jar
  674423b1 (LOCAL_ONLY) 20150126035811 plugins/HandleExtraFileTypes.class
  be06fe59 (LOCAL_ONLY) 20140827090551 plugins/action_bar202.jar
Comment 1 Wayne Rasband 2015-03-01 08:00:47 CST
I get the following exception when I copy the Red_And_Blue.java plugin included with ImageJ into Fiji.app/plugins and try to compile it in Fiji using Plugins>Compile and Run. Plugins>Compile and Run works as expected in ImageJ 1.49p.

ImageJ (Fiji Is Just) ImageJ 2.0.0-rc-24/1.49p; Java 1.8.0_25 [64-bit]; Mac OS X 10.10.1; 52MB of 6983MB (<1%)
 
java.lang.Exception: Could not compile /Applications/Fiji.app/plugins//Red_And_Blue.java:
/Applications/Fiji.app/plugins/Red_And_Blue.java:8: cannot access java.lang.Object
bad class file: ZipFileIndexFileObject[/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Object.class)]
class file has wrong version 52.0, should be 50.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
public class Red_And_Blue implements PlugIn {
       ^

	at fiji.scripting.java.Refresh_Javas.compile(Refresh_Javas.java:369)
	at fiji.scripting.java.Refresh_Javas.compile(Refresh_Javas.java:320)
	at fiji.scripting.java.Refresh_Javas.compile(Refresh_Javas.java:313)
	at fiji.scripting.java.Refresh_Javas.compileAndRun(Refresh_Javas.java:105)
	at fiji.scripting.java.Refresh_Javas.runScript(Refresh_Javas.java:71)
	at common.RefreshScripts.run(RefreshScripts.java:287)
	at fiji.scripting.java.Refresh_Javas.run(Refresh_Javas.java:61)
	at ij.IJ.runUserPlugIn(IJ.java:199)
	at ij.IJ.runPlugIn(IJ.java:163)
	at ij.IJ.runPlugIn(IJ.java:152)
	at fiji.Compile_and_Run.run(Compile_and_Run.java:23)
	at ij.IJ.runUserPlugIn(IJ.java:199)
	at ij.IJ.runPlugIn(IJ.java:163)
	at ij.Executer.runCommand(Executer.java:131)
	at ij.Executer.run(Executer.java:64)
	at java.lang.Thread.run(Thread.java:745)

I get this exception if I open Red_And_Blue.java in the Script Editor and try to compile and run by clicking on the "Run" button:

Started Red_And_Blue.java at Sun Mar 01 08:56:17 EST 2015
Compiling 1 file in /var/folders/sj/hs9p4kxn1z9brlkf83ycm4qr0000gn/T/java4446364991685643541
/var/folders/sj/hs9p4kxn1z9brlkf83ycm4qr0000gn/T/java4446364991685643541/src/main/java/Red_And_Blue.java:8: cannot access java.lang.Object
bad class file: ZipFileIndexFileObject[/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Object.class)]
class file has wrong version 52.0, should be 50.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
public class Red_And_Blue implements PlugIn {
       ^
org.scijava.minimaven.JavaCompiler$CompileError: Compile error: 1
	at org.scijava.minimaven.JavaCompiler.call(JavaCompiler.java:80)
	at org.scijava.minimaven.MavenProject.build(MavenProject.java:477)
	at org.scijava.minimaven.MavenProject.build(MavenProject.java:406)
	at org.scijava.minimaven.MavenProject.build(MavenProject.java:391)
	at org.scijava.plugins.scripting.java.JavaEngine.eval(JavaEngine.java:154)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:175)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65)
	at org.scijava.thread.DefaultThreadService$2.call(DefaultThreadService.java:164)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Comment 2 Andres Lorente 2015-03-01 12:21:24 CST
To complement my initial posting. The message I get when I press the "Compile and Run" is:

' The "Compile and Run" command is not currently supported. We recommend using the Script Editor or an IDE such as Eclipse for plugin development. '

I apologize for my previous one line comment. Wayne, thanks for expanding the bug report.

All best,
Andrés
Comment 3 Wayne Rasband 2015-03-01 15:58:53 CST
I updated Fiji and now also get the message

"The "Compile and Run" command is not currently supported. We recommend using the Script Editor or an IDE such as Eclipse for plugin development."

when I try to use the Plugins>Compile and Run Command. I am using Fiji 2.0.0-rc-25/1.49p and Java 1.8.0_25 [64-bit] on OS X 10.10.1.

When I open the "Red_And_Blue.java" file in the Script Editor and click "Run" I get this exception:

Started Red_And_Blue.java at Sun Mar 01 16:33:21 EST 2015
Compiling 1 file in /var/folders/sj/hs9p4kxn1z9brlkf83ycm4qr0000gn/T/java218593696282971329
/var/folders/sj/hs9p4kxn1z9brlkf83ycm4qr0000gn/T/java218593696282971329/src/main/java/Red_And_Blue.java:8: cannot access java.lang.Object
bad class file: ZipFileIndexFileObject[/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/lib/ct.sym(META-INF/sym/rt.jar/java/lang/Object.class)]
class file has wrong version 52.0, should be 50.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
public class Red_And_Blue implements PlugIn {
       ^
org.scijava.minimaven.JavaCompiler$CompileError: Compile error: 1
	at org.scijava.minimaven.JavaCompiler.call(JavaCompiler.java:80)
	at org.scijava.minimaven.MavenProject.build(MavenProject.java:477)
	at org.scijava.minimaven.MavenProject.build(MavenProject.java:406)
	at org.scijava.minimaven.MavenProject.build(MavenProject.java:391)
	at org.scijava.plugins.scripting.java.JavaEngine.eval(JavaEngine.java:154)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:175)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65)
	at org.scijava.thread.DefaultThreadService$2.call(DefaultThreadService.java:164)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Comment 4 Curtis Rueden 2015-03-01 23:08:01 CST
We do not currently have the resources to make "Compile and Run" work as expected in ImageJ2. For those curious why, some related technical details can be seen here:

  https://github.com/imagej/ij1-patcher/issues/31#issuecomment-52185528

The "cannot access java.lang.Object bad class file" error is a different problem that is new to me. I filed an issue for it here:

  https://github.com/scijava/scripting-java/issues/7

When testing this myself, I received a different error, also new to me, which I filed at:

  https://github.com/scijava/scripting-java/issues/6

Even before these bugs cropped up, using Java in the Script Editor suffered from another very serious bug:

   https://github.com/scijava/scripting-java/issues/5

So I would definitely recommend using a dedicated tool such as Eclipse to develop one's ImageJ plugins. (The Script Editor is best for scripts and macros.)

Plugin authors should distribute their plugins using an update site (http://imagej.net/Update_Sites), or at least as a .jar or .class file, rather than as a .java file.

If you feel you have a compelling use case for the Compile and Run command that would justify the substantial amount of time required to make it work in ImageJ2, I invite you to start a discussion about it on the imagej-devel mailing list:

  http://imagej.net/Mailing_Lists