http://imagej.273.s1.nabble.com/problem-with-using-external-jar-files-with-the-compile-and-run-command-tp3704060p3704065.html
Jama-1.0.1.jar calling it from a plugin without problems. I just have to
put it into the plugins-folder. No entry in the classpath necessary.
ImageJ seems to load the classes in the jar-file by itself.
This info is only for the compiled plugin, though. For compiling a
plugin, one might have to put Jama into the classpath. I use eclipse,
where I declare Jama as external jar-file.
> In Windows, I think you are supposed to be able to add a .jar file to the
> class path in the Target line of a shortcut that runs ImageJ. It didn't
> work for me; I still got "Package Jama not found in import." Plan B was to
> download the source for the Jama package to the Plugins folder. This
> produced an error I haven't seen before:
>
> error: Invalid class file format in C:\ImageJFST\plugins\Jama\Matrix.class.
> invalid constant type: 13
>
> What I finally stumbled through is given below. It obviously should not be
> this difficult. One thing that is probably still not right is that Matrix
> has a print method that writes to System.out, and this does not seem to be
> visible.
>
> 1. Download the source from
http://math.nist.gov/javanumerics/jama/#Package> 2. Expand and place the Jama folder in ImageJ\Plugins
> 3. Delete all the .class files in the top level of the Jama folder
> 4. Move Maths.java from Jama\util to Jama
> 5. Delete the Jama\util folder.
> 6. Edit Math.java and change "Package Jama.util;" to "Package Jama;"
> 7. Edit Matrix.java, EigenvalueDecomposition.java, QRDecomposition.java, and
> SingularValueDecomposition.java to remove "import Jama.util.*;"
> 8. Create a test plugin, such as Test_Jama.java, below.
> 9. Start ImageJ and "compile and run" the test plugin.
>
> Test_Jama.java:
>
> import ij.*;
> import ij.plugin.PlugIn;
> import Jama.*;
>
> public class Test_Jama implements PlugIn{
> public void run(String arg) {
> double[][] F = new double[3][3];
> for (int j = 0; j < 3; j++)
> for (int i = 0; i < 3; i++)
> F[i][j] = i+j;
> Matrix Fm = new Matrix(F);
> SingularValueDecomposition svd = Fm.svd();
> int rank = svd.rank();
> IJ.write("Rank = "+rank);
> }
> }
>
>
> Bob
>
>
>
> Robert P. Dougherty, Ph.D.
> President, OptiNav, Inc.
> Phone (425) 467-1118
> Fax (425) 467-1119
> www.optinav.com
>
>
>
>>On Mac OSX (like my system) that's usually in ~/Library/Java/
>>Extensions. On a Windoze system it's in the lib\ext directory of
>>your Java installation. If you are using the JRE that comes with
>>ImageJ, it's in the lib\ext directory of that installation.
>>
>>I use Jama in ImageJ plugins using the above locations without problem.
>>
>>Since you ARE on Windoze (from your post), if the above locations
>>can't be found, perhaps someone else on the list more familiar with
>>your operating system can chime in.
>>
>>
>>>
>>>When using the ImageJ "Compile and run..." command for my plugin, I
>>>get the following error:
>>>
>>>----------------------------------------------------------------------
>>>--
>>>Note: sun.tools.javac.Main has been deprecated.
>>>C:\Programme\ImageJ\plugins\Template_Matching_.java:25: Package
>>>Jama not found in import.
>>>import Jama.*;
>>> ^
>>>What can I do to use the package "Jama-1.0.2.jar".
>>>I copied this jar-File to my imagej-directory and to the plugins-
>>>directory.
Dr. Joachim Walter
TILL I.D. GmbH
Großhaderner Str. 2