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 1074 - I could not compile the Versatile Wand plugin
I could not compile the Versatile Wand plugin
Status: CONFIRMED
Product: Fiji
Classification: Unclassified
Component: Plugins
unspecified
Macintosh Mac OS
: P4 normal
Assigned To: ImageJ Bugs Mailing List
Depends on:
Blocks:
 
Reported: 2015-05-21 23:51 CDT by Avital Steinberg
Modified: 2015-09-19 22:33 CDT
5 users (show)

See Also:

Description Avital Steinberg 2015-05-21 23:51:05 CDT
I downloaded the versatile_wand.java file from:

 http://imagejdocu.tudor.lu/doku.php?id=plugin:segmentation:versatile_wand:start

changed its name to Versatile_Wand.java, put it in the plugins folder and tried to compile it. It did not form a .class file. The only way to run this plugin in Fiji was to compile it using ImageJ.

Information about your version of Java:

  os.arch => x86_64
  os.name => Mac OS X
  os.version => 10.9.5
  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-462-11M4609
  java.vm.name => Java HotSpot(TM) 64-Bit Server VM
  java.vm.version => 20.65-b04-462
  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:20150501134914)
Fiji: http://fiji.sc/update/ (last check:20150520024906)

Files not up-to-date:
  ed67c174 (LOCAL_ONLY) 20150522025708 plugins/Versatile_Wand.class
Comment 1 Wayne Rasband 2015-05-22 10:59:19 CDT
Using Java 1.6.0_65 on OS X 10.10.2, I can compile and run Versatile_Wand.java by clicking on "Run" in the Script Editor. I can then install the Versatile Wand as a tool by checking "Install Tool" in the dialog and clicking "OK", but I get this error message

   Could not load class Versatile_Wand in line 6
   call("Versatile_Wand.setOptions");

when I attempt to open the Versatile Wand Options dialog by double clicking on the tool icon.

When I run the "Versatile Wand" command from the Plugins menu I get this error message in the "Console" window:

Compiling 1 file in   /var/folders/sj/hs9p4kxn1z9brlkf83ycm4qr0000gn/T/java898253394430329430
Note: /var/folders/sj/hs9p4kxn1z9brlkf83ycm4qr0000gn/T/java898253394430329430/src/main/java/Versatile_Wand.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

Using Java jdk1.8.0_45.jdk on OS X 10.10.3, I get this error message when I open Versatile_Wand.java in the Script Editor and click "Run":

Started Versatile_Wand.java at Fri May 22 11:21:30 EDT 2015
Compiling 1 file in /var/folders/sj/hs9p4kxn1z9brlkf83ycm4qr0000gn/T/java4428824321535213749
/var/folders/sj/hs9p4kxn1z9brlkf83ycm4qr0000gn/T/java4428824321535213749/src/main/java/Versatile_Wand.java:16: cannot access java.util.Hashtable
bad class file: ZipFileIndexFileObject[/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/lib/ct.sym(META-INF/sym/rt.jar/java/util/Hashtable.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.
import java.util.Hashtable;
                ^
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.compile(JavaEngine.java:211)
	at org.scijava.plugins.scripting.java.JavaEngine.eval(JavaEngine.java:135)
	at org.scijava.plugins.scripting.java.JavaEngine.eval(JavaEngine.java:173)
	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:181)
	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)
java.lang.NullPointerException
	at java.lang.Class.isAssignableFrom(Native Method)
	at org.scijava.plugins.scripting.java.CommandJavaRunner.supports(CommandJavaRunner.java:71)
	at org.scijava.plugins.scripting.java.CommandJavaRunner.supports(CommandJavaRunner.java:46)
	at org.scijava.plugins.scripting.java.DefaultJavaService.run(DefaultJavaService.java:60)
	at org.scijava.plugins.scripting.java.JavaEngine.eval(JavaEngine.java:136)
	at org.scijava.plugins.scripting.java.JavaEngine.eval(JavaEngine.java:173)
	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:181)
	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 Mark Hiner 2015-05-22 14:11:17 CDT
Compiling in the Script Editor is currently broken with Java 8 by default. An explanation and workaround is discussed here: https://github.com/fiji/fiji/issues/119
Comment 3 Wayne Rasband 2015-05-24 14:07:25 CDT
Compiling in the Script Editor is also broken with Java 6. To reproduce:

1. Open the Script Editor.
2. Open Templates>Java>Plot Example.
3. Click "Run" and save on the Desktop (you are not allowed to save in Fiji.app/plugins).
4. The plugin runs and displays a window named "Example plot".
5. Attempts to re-run, without re-compiling, fail because there is no "Plot Example" command in the Plugins menu or in the "Command Finder" dialog.
6. The macro command run("Plot Example") also fails, evan after restarting Fiji.
Comment 4 Curtis Rueden 2015-05-26 09:05:09 CDT
Thanks Wayne. But it seems like (mostly) intended behavior to me. When you click "Run" in the Script Editor, it compiles the Java code, saves a temporary class file, and runs it. It does not install the plugin anywhere in ImageJ's menus. So it's true that the only way to run the plugin again is to execute the Script Editor's "Run" function again, which will recompile the plugin (though there is a critical bug: https://github.com/scijava/scripting-java/issues/5).

Installing the compiled plugin into the menu structure would be a different operation. It seems this can be done with Plugins > Install PlugIn..., although a restart of ImageJ is needed. But the behavior is not ideal right now; in particular, the Console window always shows "Compiling 1 file in ..." messages when the plugin is subsequently run.

I definitely agree that all of this should be improved. But to honest it is not something LOCI has time to work on any time soon -- we feel it is much more urgent to improve support for Java 7 and 8, fix behavior on the latest OS X versions, address other related launcher problems, etc. For ImageJ plugin development, there are already (IMO better) tools such as Eclipse and NetBeans.
Comment 5 Wayne Rasband 2015-05-26 15:18:08 CDT
Eclipse and NetBeans can be overwhelming to a scientist who wants to develop a simple plugin or who wants to install a plugin only available in source form. The Script Editor should have an Install command similar to the Plugins>Compile and Run command, which no longer works in Fiji. Fiji's Plugins>Install Plugin command is not the solution since the installed plugin appears to be compiled every time you run it.
Comment 6 Curtis Rueden 2015-05-26 17:09:06 CDT
> Eclipse and NetBeans can be overwhelming to a scientist who wants to develop a simple plugin

I agree, but would also argue the scientist should not use Java if their goal is simplicity. Better to use one of the many other supported scripting languages such as Javascript, Jython or Groovy. These other languages require less boilerplate, and have fewer problems currently in the Script Editor.

> The Script Editor should have an Install command similar to the Plugins>Compile and Run command, which no longer works in Fiji.

Agreed.

> Fiji's Plugins>Install Plugin command is not the solution since the installed plugin appears to be compiled every time you run it.

Perhaps the behavior of that command can be improved and migrated into ImageJ2 core.

I filed an issue to track this feature request:
  https://github.com/imagej/imagej-ui-swing/issues/44
Comment 7 jrr1985 2015-09-19 10:56:53 CDT
Sorry, I am new to imagej. Has anyone figured this out? If so can someone post the plugin so I can install it? I appreciate it.
Comment 8 Wayne Rasband 2015-09-19 22:33:53 CDT
There is a version of the Versatile Wand Tool at

  http://wsr.imagej.net/plugins/Versatile_Wand_Tool.jar

that works with Fiji.