Posted by
Fred Damen on
Jun 20, 2020; 4:36am
URL: http://imagej.273.s1.nabble.com/Compiling-directories-and-jar-files-rules-tp5023539p5023541.html
Greetings,
Thanks for the reply. My concern was more with using the plugin
(Gun_Plot) as a library by other plugins, as opposed to modifying the
plugin (Gnu_Plot) itself. My concern is mostly centered around someone
besides me, grabs and installs Gnu_Plot.jar and wants to, say, write a
plugin to plot the histogram of a phase image as a polar plot. What does
this person have to do to "Compile and Run" using the Gnu_Plot.plot
method? If they unpack Gnu_Plot.jar into plugins, then there is nothing
else they have to do; this seems messy and annoying. If they unpack into a
subdirectory solely for Gnu_Plot, i.e, less messy, albeit the "Compile and
Run" will not find Gnu_Plot. What can I do to make this seamless for them,
i.e., they don't have to do anything but put Gnu_Plot.jar in plugins or a
subdirectory?
From reading the code to dynamically load the plugins when a plugin is
run, it seems to look inside jar files within plugins and one subdirectory
beneath. It would seem that the .class files could be found inside the JAR
file also when "Compile and Run", although the way I created Gnu_Plot.jar
this does not seem to be the case. Is there a way to create the JAR file
such that "Compile and Run" will find .class files from within?
When there is a underscore in the name of the JAR file, ImageJ pays
attention to the plugins.config file, and in conjunction, ignores the
.class files within the subdirectory that the Gnu_Plot.jar file exists.
When the JAR file does not contain an underscore then "Compile and Run"
finds the .class files.
Putting the underscored JAR file in the plugins/jars directory will be
more annoyance then it is worth, as on Fedora and possibly other Linux
distributions, the plugins/jars directory is softlink(ed) to system
directories. It would be easier to just unpack the ZIP file into the
plugins directory; albeit nicer if there were only one copy of the .class
files. Although, do the JAR files need to be in plugins/jars for "Compile
and Run" to find .class files from with JAR files?
Fred
On Fri, June 19, 2020 4:44 am, CARL Philippe (LBP) wrote:
> Dear Fred,
> I don't know whether what I will be describing below is "the recommended
> method", nevertheless so far it was always working for me.
> 1) Thus in the case I wan't to modify a plugin or package packed within a
> .jar file, I close ImageJ, move the .jar file out from the plugins folder
> (or subfolder within the plugins folder) into the ImageJ root folder (i.e.
> the one where there is the ImageJ.exe file). By doing so ImageJ won't
> anymore be able to detect the .jar file as in the same time I don't move
> the .jar too far away from where I will soon need it again.
> Then I unpack the .jar content into a dedicated folder within the plugins
> folder and work on the code from there, i.e. modify the code and
> Compile&run it until I'm happy with the obtained version.
> Once done I close again ImageJ, overwrite the old .java and .class files
> with the .jar file I had put in the ImageJ root folder by the new obtained
> one, move the .jar file back into the plugins folder and either erase the
> folder I worked in (or move it to the ImageJ root folder in the case I
> think that I may probably soon modify again the code).
> 2) I also saw that if you want to access to classes packed within other
> .jar (than the one you are working on) you should rather put these .jar
> files within the plugins/jars folder to be able to access them (which is
> very probably the answer to your described issue).
> I hope this helps you to move further.
> My best regards,
> Philippe
>
> Philippe CARL
> Laboratoire de Bioimagerie et Pathologies
> UMR 7021 CNRS - Université de Strasbourg
> Faculté de Pharmacie
> 74 route du Rhin
> 67401 ILLKIRCH
> Tel : +33(0)3 68 85 42 89
>
> ----- Mail original -----
> De: "Fred Damen" <
[hidden email]>
> Ã: "imagej" <
[hidden email]>
> Envoyé: Jeudi 18 Juin 2020 22:33:48
> Objet: Compiling, directories, and jar files rules
>
> Greetings,
>
> I am seeing what seems strange when using "Compile and Run" regarding
> class names and JAR file names. I am trying to compile a Java plugin that
> uses a class for a plugin (Gnu_Plot) that I placed in a subdirectory
> (Gnu_Plot) of plugins and created a jar file (Gnu_Plot.jar) for this
> plugin, following
https://imagej.nih.gov/ij/plugins/jar-demo.html. Running
> Gnu_Plot from the menus works fine. Trying to compile another plugin that
> calls Gnu_plot methods does not know of the existence of Gnu_Plot, Even
> though the java source and class files exist in the subdirectory and jar
> file. Renaming the jar file to GnuPlot.jar, with and without restarting
> ImageJ, the "Compile and Run" now finds Gnu_Plot and this plugin compiles
> fine.
>
> a) In the case that I described above, where is "Compile and Run" supposed
> to find the class files, from within the jar file, from within
> subdirectories? search order?
> b) Is there a specific place that the class files need to be within the
> jar file for them to be found during compiling?
>
> Thanks in advance,
>
> Fred
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html