You don't have to put ("run") at the end of your plugins.config lines.
should work.
> Stephan,
>
> You're right, of course, I should have used a new in my test_2.java example
> (it is in the original code, but didn't survive when I rewrote the
> simplified illustration). But where I'm stuck is at the point before test_2
> enters the picture. Basically, I can't get experiment 2 (which only
> involves the packaged version of test_1) to work. You're also correct that
> this may be a Java problem, not an ImageJ problem, since I'm new to both.
> To focus a bit more clearly on my current stopper, this fails:
>
> test_1.java:
> package my_stuff;
>
> import ij.*;
> import ij.process.*;
> import ij.gui.*;
> import java.awt.*;
> import ij.plugin.*;
>
> public class test_1 implements PlugIn {
>
> public void run(String arg) { shared_method(); }
>
> public void shared_method() { IJ.showMessage("test_1","Hello world!"); }
> }
>
>
> plugins.config:
>
> # Name: Test_Plugin
>
> # Author: Bob
> # Version: 1.0
> # Date: 1/18/10
> # Requires: ImageJ 1.31s
>
> Plugins>Test, "Test 1", my_stuff.test_1("run")
>
> The issue may be in the way I compile, by just using the "Compile and
> Run..." in ImageJ to generate test_1.class, and then manually making the
> .jar file using "jar cvfM Test.jar test_1.class test_1.java plugins.config".
> However, it seems more likely to me that I have the syntax wrong in the last
> line of plugins.config. The error message I am getting is: "Plugin or
> class not found: 'my_stuff.test_1' (java.lang.ClassNotFoundException:
> my_stuff.test_1)"
>
>
>> Your problems are on Java syntax, not ImageJ ;)---read:
>>
>>
http://java.sun.com/docs/books/tutorial/java/index.html>>
>> I your case, what you're trying is to use an instance method in a static
>> way. In Java, an object is not instantiated just by declaring it, you
>> have to use new. So either:
>>
>> test_1.java:
>>
>> public class test_1 implements PlugIn {
>>
>> public void run(String arg) { shared_method(); }
>>
>> static public void shared_method() { IJ.showMessage("test_1","Hello
>> world!"); }
>> }
>>
>> or leaving test_1 as you had it before:
>>
>> test_2.java:
>>
>> public class test_2 implements PlugIn {
>>
>> public void run(String arg) {
>> test_1 temp = new test_1();
>> temp.shared_method();
>> }
>>
>> }
>>
>> The previous test_1/test_2 combination shouldn't have been compilable.
>>
>> Best,
>> Stephan