Re: ImageJ Plugin

Posted by Hao An on
URL: http://imagej.273.s1.nabble.com/ImageJ-Plugin-tp3700388p3700390.html

I do not have the line of "package plugins".

I noticed that My_Plugin works for my installed imageJ1.37v, but not for
the one generated from source code by ant run.  When I click
Plugins>Compile and Run.  It gave me that:

This JVM does not include the javac compiler. Javac is included with the
Windows and Linux versions of ImageJ that are bundled with Java.

I wrote the macro(write(call("java.lang.System.getProperty",
"java.home")), and I got this

C:\Program Files\java\jdk1.5.0_04\jre

That looks fine to me.

But why Plugins>Compile and Run not work for ant-built ImageJ.

Many thanks.

Hao





-----Original Message-----
From: Johannes Schindelin [mailto:[hidden email]]
Sent: Tuesday, February 06, 2007 4:23 PM
To: Hao An
Cc: [hidden email]
Subject: Re: ImageJ Plugin

Hi,

On Tue, 6 Feb 2007, Hao An wrote:

> I am working on create my plugins. But I keep getting following error
> message:
>
> Plugin or class not found: "My_Plugin"
> (java.lang.NoClassDefFoundError: My_Plugin(wrong
> name:plugins/My_Plugin))
>
> But I am sure I put My_Plugin.java and My_Plugin.class under plugins
> fold.

I answered a similar question recently:

http://article.gmane.org/gmane.comp.java.imagej/6992

The problem is that unless you package the class files, you _must not_
put
the class into a package. In other words, if you remove the line

        package plugins;

from your java file, it will start to work.

Hth,
Dscho