Compiling, directories, and jar files rules

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Compiling, directories, and jar files rules

Fred Damen
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
Reply | Threaded
Open this post in threaded view
|

Re: Compiling, directories, and jar files rules

CARL Philippe (LBP)
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
Reply | Threaded
Open this post in threaded view
|

Re: Compiling, directories, and jar files rules

Fred Damen
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
Reply | Threaded
Open this post in threaded view
|

Re: Compiling, directories, and jar files rules

Gabriel Landini
On Saturday, 20 June 2020 05:36:23 BST you wrote:
> 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.  

I do not know the answer to your other questions, but the above is not the
case in Ubuntu or Opensuse. I have ImageJ installed it in the folder I want in
my home directory. Just unpacked the installation download from the IJ site.

But perhaps I did not understand the problem. Is it that you do not have write
access to that soft-linked folder?
I doubt that it is IJ's fault, but the logic followed by the Fedora installer.
If you are not supposed to have write access to a system folder for security
reasons, why would you expect to be able to write to it as a user?  Isn't that
restricted to the administrator? If you are the administrator, can't you grant
yourself write access?

> It would be easier to just unpack the ZIP file into the
> plugins directory;

That is how I do it in linux.

Cheers

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Compiling, directories, and jar files rules

CARL Philippe (LBP)
In reply to this post by Fred Damen
Dear Fred,
I really apologize about the fact that English isn't my mother langage and thus I have certain difficulties to understand all what you are writing.
Thus from I have understand, you have written a kind of library plugin (Gun_Plot) and you ask what you should do so that users of other plugins could use your tool, is this correct?
If this is the case, one easy solution would be to create a GUI for your plugin that could then be recorded to be used through a IJ.run access.
Another (i.e. more direct way) would be to have a (or maybe even several) public stactic method(s) that could then be accessed from outside.
Nevertheless if I'm still wrong within my understanding of your issue, could you please shorten and simplify your request.
Have a nice week-end,
Philippe

----- Mail original -----
De: "Fred Damen" <[hidden email]>
À: "imagej" <[hidden email]>
Envoyé: Samedi 20 Juin 2020 06:36:23
Objet: Re: Compiling, directories, and jar files rules

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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Compiling, directories, and jar files rules

Wayne Rasband-2
In reply to this post by Fred Damen
> On Jun 18, 2020, at 4:33 PM, Fred Damen <[hidden email]> wrote:
>
> 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,

Library JAR files (e.g., Gnu_Plot.jar) should be located in the plugins/jars directory.

-wayne


> 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
Reply | Threaded
Open this post in threaded view
|

Re: Compiling, directories, and jar files rules

CARL Philippe (LBP)
Dear Wayne,
I already made the very same answer on my reply sent yesterday, but this didn't seem to be the answer Fred was waiting for!
Take care,
Philippe

----- Mail original -----
De: "Wayne Rasband" <[hidden email]>
À: "imagej" <[hidden email]>
Envoyé: Samedi 20 Juin 2020 18:34:47
Objet: Re: Compiling, directories, and jar files rules

> On Jun 18, 2020, at 4:33 PM, Fred Damen <[hidden email]> wrote:
>
> 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,

Library JAR files (e.g., Gnu_Plot.jar) should be located in the plugins/jars directory.

-wayne


> 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
Reply | Threaded
Open this post in threaded view
|

Re: Compiling, directories, and jar files rules

Fred Damen
In reply to this post by Gabriel Landini
Greetings Gabriel,

My concern is not with how I have to deal with the plugin/library, the
concern is with someone else who grabs the plugin from
https://imagej.net/Gnu_Plot and then tries to write a plugin of their own
Java plugin that uses its public methods.  When they have trouble
accomplishing this I then have to spend time trying to fix things.

When ImageJ is installed from the package manager on Fedora the user's
.imagej/plugins/jars directory is softlink(ed) to
/usr/share/imagej/plugins/jars, which is a admin controlled directory.

I am not trying to pass blame or necessarily request any changes.  The
problem I face is, what to put in the INSTALL section of
https://imagej.net/Gnu_Plot that causes me the least headaches going
forward.  I usually find it easier to follow the way it is supposed to
work, and thus the question.  I was trying to avoid just dumping
everything directly into the plugins directory, but it is looking like
that may be the easiest solution.

Thanks again for the response,

Fred

On Sat, June 20, 2020 5:50 am, Gabriel Landini wrote:

> On Saturday, 20 June 2020 05:36:23 BST you wrote:
>> 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.
>
> I do not know the answer to your other questions, but the above is not the
> case in Ubuntu or Opensuse. I have ImageJ installed it in the folder I
> want in
> my home directory. Just unpacked the installation download from the IJ
> site.
>
> But perhaps I did not understand the problem. Is it that you do not have
> write
> access to that soft-linked folder?
> I doubt that it is IJ's fault, but the logic followed by the Fedora
> installer.
> If you are not supposed to have write access to a system folder for
> security
> reasons, why would you expect to be able to write to it as a user?  Isn't
> that
> restricted to the administrator? If you are the administrator, can't you
> grant
> yourself write access?
>
>> It would be easier to just unpack the ZIP file into the
>> plugins directory;
>
> That is how I do it in linux.
>
> Cheers
>
> Gabriel
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Compiling, directories, and jar files rules

Fred Damen
In reply to this post by CARL Philippe (LBP)
Greetings,

First, thanks for the replies.

I was looking for the answer to the question 'how should installing
library JAR files be done?", and not how can this be done?  Philippe, your
answer seemed to be how you get around the hindrances to "Compile and Run"
as opposed to how this was setup (supposed) to work.  I find that
following the rules generally works best, albeit, this requires knowing
the rules first.

Now that I know this rule, I will proceed to a solution that resolves my
issue.

My 2 cents:  It would be nice if the .class files within one subdirectory
level below plugins are not ignored by "Compile and Run" when a JAR file
with an underscore in its name exists in said subdirectory.  It would be
really nice if the .class files that can be found when being run as a
plugin, they can also be found by "Compile and Run".

Thanks again,

Fred

On Sat, June 20, 2020 2:46 pm, CARL Philippe (LBP) wrote:

> Dear Wayne,
> I already made the very same answer on my reply sent yesterday, but this
> didn't seem to be the answer Fred was waiting for!
> Take care,
> Philippe
>
> ----- Mail original -----
> De: "Wayne Rasband" <[hidden email]>
> À: "imagej" <[hidden email]>
> Envoyé: Samedi 20 Juin 2020 18:34:47
> Objet: Re: Compiling, directories, and jar files rules
>
>> On Jun 18, 2020, at 4:33 PM, Fred Damen <[hidden email]> wrote:
>>
>> 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,
>
> Library JAR files (e.g., Gnu_Plot.jar) should be located in the
> plugins/jars directory.
>
> -wayne
>
>
>> 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
Reply | Threaded
Open this post in threaded view
|

Re: Compiling, directories, and jar files rules

Wayne Rasband-2
In reply to this post by Fred Damen
> On Jun 22, 2020, at 1:52 PM, Fred Damen <[hidden email]> wrote:
>
> Greetings Gabriel,
>
> My concern is not with how I have to deal with the plugin/library, the
> concern is with someone else who grabs the plugin from
> https://imagej.net/Gnu_Plot and then tries to write a plugin of their own
> Java plugin that uses its public methods.  When they have trouble
> accomplishing this I then have to spend time trying to fix things.
>
> When ImageJ is installed from the package manager on Fedora the user's
> .imagej/plugins/jars directory is softlink(ed) to
> /usr/share/imagej/plugins/jars, which is a admin controlled directory.

Starting with the ImageJ 1.53c58 daily build, library JAR files can also be located in the plugin/lib directory. The following helpful information is now displayed in the Edit>Options>Compiler dialog box:

   "Library JAR files (e.g., imagescience.jar) should
   be located in either plugins/jars or plugins/lib.
   The javac command line will be displayed in
   the Log window if ImageJ is in debug mode.”

-wayne



>
> I am not trying to pass blame or necessarily request any changes.  The
> problem I face is, what to put in the INSTALL section of
> https://imagej.net/Gnu_Plot that causes me the least headaches going
> forward.  I usually find it easier to follow the way it is supposed to
> work, and thus the question.  I was trying to avoid just dumping
> everything directly into the plugins directory, but it is looking like
> that may be the easiest solution.
>
> Thanks again for the response,
>
> Fred
>
> On Sat, June 20, 2020 5:50 am, Gabriel Landini wrote:
>> On Saturday, 20 June 2020 05:36:23 BST you wrote:
>>> 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.
>>
>> I do not know the answer to your other questions, but the above is not the
>> case in Ubuntu or Opensuse. I have ImageJ installed it in the folder I
>> want in
>> my home directory. Just unpacked the installation download from the IJ
>> site.
>>
>> But perhaps I did not understand the problem. Is it that you do not have
>> write
>> access to that soft-linked folder?
>> I doubt that it is IJ's fault, but the logic followed by the Fedora
>> installer.
>> If you are not supposed to have write access to a system folder for
>> security
>> reasons, why would you expect to be able to write to it as a user?  Isn't
>> that
>> restricted to the administrator? If you are the administrator, can't you
>> grant
>> yourself write access?
>>
>>> It would be easier to just unpack the ZIP file into the
>>> plugins directory;
>>
>> That is how I do it in linux.
>>
>> Cheers
>>
>> Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Compiling, directories, and jar files rules

Kenneth Sloan-2
This discussion is very timely for me.

As always - I do things a bit differently, but am trying to understand the current ImageJ conventions.

I typically compile plugins and create .jar files completely outside of ImageJ (the reasons are complicated, but this is unlikely to change).

Many of my plugins are completely independent of each other, and I try to make the .jar file for each one completely self-contained.  This has (predictably) lead to some duplication - which is not really a problem, but I’m trying to use a better structure.

Currently, I install .jar files by dragging&dropping on my FIJI development environment.  Clients can download .jar files from my Box account - or (more recently) use my ImageJ update site to download and install.  All this works great.

Except…when I upload, I see that my duplications generate automatic dependencies (even circular dependencies) that I have to manually break.  This is only a small  annoyance, but yet another reason for me to try something new.

So - I’m about to split off a few utility clusters of classes and package each cluster as it’s own .jar file.

Questions:

a) am I correct that these .jar files should be installed in plugins/lib or plugins/jars?
b) is one of these “preferred”?
c) when uploading new versions of the top level plugin, how do I specify the dependency on the subsidiary .jar files?
d) when a client uses the ImageJ update site, what controls WHERE the subsidiary .jar files go? (I’m imagining a scenario where, left to their own devices, a client may put copies in BOTH plugins/lib and plugins/jars - so I’d like this under MY control, if possible).

Right now, I can think of at least 5 clusters that are mature enough to “publish” without fear of serious re-factoring.  After that, there are perhaps another 5 small clusters of utilities.

Question:
e) is it reasonable to put EVERYTHING in one .jar file (“MyVeryOwnUtilities.jar”) - or is it better to create separate .jar files for each independent cluster of classes?  Does it really matter?

I would appreciate guidance on the best way to proceed - but please, don’t suggest major changes in my development environment.  For various reasons, I’m content with, and not likely to change my current tools, which are:

a) Emacs
b) ant
c) javac

Finally, my documentation is decidedly primitive, with virtually all important documentation written into the comments of my (java) code.  I flirted with JavaDoc a decade or so ago and found it less than useful.  I’m considering adding a few readMe.txt files scattered here and there and wonder - is there some mechanism I should consider?  My current plan is to include readMe.txt files in the distributed .jar files.  This may extend to .pdf files at some point.

And yet more (so…I lied about “finally”) at the moment, about half of my portfolio of plugins are “mature products” which I intend to be largely unchanged over the next 5 year, and another half are “quick hacks” which are aimed at very specific research projects.  Some of these evolve into mature products; some continue to be used as “quick hacks” longer than they should, and some become dormant, even obsolete, until someone remembers one of them and I have to revive it from the ashes.  I’m getting better at spotting the “quick hacks” which should be written as quick hacks and those which should be generalized and born as “industrial strength”.  I’m constantly trying to balance these considerations - but not always succeeding.

Is it feasible to manage 10 different projects all using the same ImageJ update site?  If so, is there any way to structure the update site to keep the several projects separate?  Or, is there a better way.  Given my initial experience, I hope to never have to establish another WIKI account - once was more than enough.  (I’m grateful to those who helped me, but it did NOT go smoothly).

Have pity on an old man - I was distributing image processing packages before the first line of NIH Image was written…


--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html