Re: Path Problem?
Posted by
Stephan Saalfeld on
Jan 19, 2010; 1:04pm
URL: http://imagej.273.s1.nabble.com/Path-problem-tp3689668p3689670.html
Your problems are on Java syntax, not ImageJ ;)---read:
http://java.sun.com/docs/books/tutorial/java/index.htmlI 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