Login  Register

Re: Trouble executing jar Plugin - nosuchmethod error

Posted by dscho on Mar 17, 2014; 12:54pm
URL: http://imagej.273.s1.nabble.com/Trouble-executing-jar-Plugin-nosuchmethod-error-tp5006911p5006951.html

Hi Steven (is Influenza your nickname?),

On Mon, 17 Mar 2014, Influenza wrote:

> My gui.class has a correct constructor, the whole Plugin works fine in the
> eclipse environment. It just throws the error when I try to implement the
> .jar folder from the eclipse project into the ImageJs Plugins directory.

This suggests that you are haunted by an incompatible Gui.class (please
note the upper-case 'G'... Java *is* case-sensitive, even if the
underlying file system might not be).

In Fiji, we have this command Plugins>Utilities>Find Jar For Class.
Calling it with the class name "Gui" leads to this output:

-- snip --
The class Gui is contained in
/Applications/Fiji.app/plugins/Volume_Viewer-2.01.1-SNAPSHOT.jar
-- snap --

The problem is of course that more than just one plugin might want to use
the class name "Gui". To counter that, Sun invented the concept of
"packages". If you put your source into, say, goerlich/Gui.java and write
"package goerlich;" anywhere before the first "import" statement, the
class name will be actually "goerlich.Gui". Must less prone to lead to
confusion.

Right now, the Gui class is in the so-called "default package", i.e. in no
package at all. The same is true for Volume Viewer's, so it's either your
plugin that gets broken by that problem, or the Volume Viewer.

Having said that, the tireless Curtis Rueden put in a lot of effort to fix
the Volume Viewer with regards to classes in the default package. I just
failed to upload the plugin until five minutes ago. If you update, you
will get those fixes.

Thus, now you should not see the problems any longer even if you leave the
Gui class in the default package. However, for exactly the same reason
Volume Viewer's classes moved into appropriate packages, I strongly
suggest you do the same.

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html