Dear all (probably Wayne),
I have the following plugin file (Call_Demo.java): public class Call_Demo { public static String method1(String arg1) { return "method1"+"("+arg1+")"; } } That I call with the following plugin (My_Plugin.java): import ij.*; import ij.plugin.*; public class My_Plugin implements PlugIn { public void run(String arg) { IJ.log(Call_Demo.method1("arg1")); } } In this case everything is working fine: i.e. I get the result "method1(arg1)" within the log window when I compile both plugins with the ImageJ Plugins->Compile_and_Run... method. If I then pack the Call_Demo.java (and Call_Demo.class) file (with the needed plugins.config file) within a jar file having no "_" within its name (for example test.jar), I cant see the "Call_Demo" plugin within the ImageJ plugin menus (in agreement to what is described here: http://imagejdocu.tudor.lu/doku.php?id=howto:plugins:howto_create_an_imagej_ plugin_jar_file) but when compiling My_Plugin.java with the the ImageJ Plugins->Compile_and_Run... method everything is still working fine (i.e. I get the result "method1(arg1)" within the log window). But if I now rename the jar file (within which the Call_Demo.java, Call_Demo.class and plugins.config file are packed) to "test_it.jar", I can now see "Call_Demo" plugin within the ImageJ plugin menus (in agreement to what is described here: http://imagejdocu.tudor.lu/doku.php?id=howto:plugins:howto_create_an_imagej_ plugin_jar_file) but when compiling My_Plugin.java with the the ImageJ Plugins->Compile_and_Run... method I get now the error: cannot find symbol symbol : variable Call_Demo location: class My_Plugin IJ.log(Call_Demo.method1("arg1"));. Nevertheless, if I put the "test_it.jar" and "My_Plugin.java" within the plugin folder of Fiji, Drag&Drop "My_Plugin.java" file within the Fiji window in order to open a Script widow where I press Run, the "My_Plugin.java" is then correctly compiled. And if I finally put the "My_Plugin.class" file obtained within Fiji inside of the ImageJ plugin folder I can then as well correctly run the "My_Plugin.class" plugin. I thank you very much in advance for your help about this issue. Kindest regards, Philippe Bien cordialement, Philippe Philippe CARL Laboratoire de Biophotonique et Pharmacologie UMR 7213 CNRS - Université de Strasbourg Faculté de Pharmacie 74 route du Rhin 67401 ILLKIRCH Tel : +33(0)3 68 85 41 84 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
The Plugins>Compile and Run command does not normally add jar files with “_” in their names to the javac class path, which means the plugin your are compiling cannot access the classes in a jar file that has an “_” in its name. As a workaround, put the jar file that needs to be accessed in the plugin/jars folder. With the latest ImageJ daily build (1.51e13), all jar files in plugins/jars are added to the javac class path.
-wayne > On Jun 20, 2016, at 6:18 AM, Philippe CARL <[hidden email]> wrote: > > Dear all (probably Wayne), > > I have the following plugin file (Call_Demo.java): > > public class Call_Demo > > { > > public static String > method1(String arg1) > > { > > return > "method1"+"("+arg1+")"; > > } > > } > > That I call with the following plugin (My_Plugin.java): > > import ij.*; > > import ij.plugin.*; > > > > public class My_Plugin implements PlugIn > > { > > public void run(String arg) > > { > > > IJ.log(Call_Demo.method1("arg1")); > > } > > } > > In this case everything is working fine: i.e. I get the result > "method1(arg1)" within the log window when I compile both plugins with the > ImageJ Plugins->Compile_and_Run... method. > > > > If I then pack the Call_Demo.java (and Call_Demo.class) file (with the > needed plugins.config file) within a jar file having no "_" within its name > (for example test.jar), I can't see the "Call_Demo" plugin within the ImageJ > plugin menus (in agreement to what is described here: > http://imagejdocu.tudor.lu/doku.php?id=howto:plugins:howto_create_an_imagej_ > plugin_jar_file) but when compiling My_Plugin.java with the the ImageJ > Plugins->Compile_and_Run... method everything is still working fine (i.e. I > get the result "method1(arg1)" within the log window). > > > > But if I now rename the jar file (within which the Call_Demo.java, > Call_Demo.class and plugins.config file are packed) to "test_it.jar", I can > now see "Call_Demo" plugin within the ImageJ plugin menus (in agreement to > what is described here: > http://imagejdocu.tudor.lu/doku.php?id=howto:plugins:howto_create_an_imagej_ > plugin_jar_file) but when compiling My_Plugin.java with the the ImageJ > Plugins->Compile_and_Run... method I get now the error: cannot find symbol > symbol : variable Call_Demo location: class My_Plugin > IJ.log(Call_Demo.method1("arg1"));. > > > > Nevertheless, if I put the "test_it.jar" and "My_Plugin.java" within the > plugin folder of Fiji, Drag&Drop "My_Plugin.java" file within the Fiji > window in order to open a Script. widow where I press Run, the > "My_Plugin.java" is then correctly compiled. > > > > And if I finally put the "My_Plugin.class" file obtained within Fiji inside > of the ImageJ plugin folder I can then as well correctly run the > "My_Plugin.class" plugin. > > > > I thank you very much in advance for your help about this issue. > > > > Kindest regards, > > > > Philippe > > > > > > > > Bien cordialement, > > Philippe > > > > Philippe CARL > > Laboratoire de Biophotonique et Pharmacologie > > UMR 7213 CNRS - Université de Strasbourg > > Faculté de Pharmacie > > 74 route du Rhin > > 67401 ILLKIRCH > > Tel : +33(0)3 68 85 41 84 > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |