How do I put linux, mac and windows files to download on my site?

I want to add a few special purpose OS dependent executable files to my download site.
I go into the ImageJ Updater and ask View all files, with the purpose of adding some OS dependent executable files to my set of files to be automatically downloaded.
Naturally, most of the files are *.jar files, but there are exceptions such as png files.
My problem is I can’t see OS dependent files I want to add.

The location I have chosen is plugins/lib where I have mostly jar files which only my plugin needs.
Here I have manually put 3 files: shaping_elongL, shaping_elongM and shaping_elongW.exe for the 3 OS, Linux Macintosh and Windows. The problem is to add them as files which can be downloaded.

How do I add them?
Thanks,
Ilan

The updater does not let you upload arbitrary files. Only certain folders and file types are allowed. See this page (a bit outdated, but mostly still accurate) for details. See also the link to the relevant source code given there.

Note that thanks to @imagejan, you can now also put platform-specific JARs in subfolders beneath the jars folder (e.g., jars/win64) according to the same naming scheme, if you need to ship them.

Do not use this location. The plugins folder is reserved for ImageJ 1.x style plugins only, not libraries.

Put them in jars. Or—if you must—jars/my-plugin where “my-plugin” is the name of your plugin. I admit we did this with Bio-Formats-specific JAR files (i.e.: we put them in jars/bio-formats) although I am still doubtful it was the right decision, since it resulted in various special-case code in a few places. Better to just put everything directly in jars I think—it’s all going onto the classpath anyway.

If you want to ship EXE files and such, you will need to put them in subdirectories of lib. That is the only place where you can do whatever file extensions you want.

Thanks for your answer Chris. When you just do something to get the job done, mistakes can be made. This is the case with plugins/lib. It worked so I used it. I am perfectly willing to straighten out my mess and do things right.

What I would like to do is put a folder named petct in the lib folder and inside there I will put my 3 executables. I see that they are visible and I can upload them.

I think what you are telling me is that I need to make another folder under jars again called petct and there I should put all my special purpose jar files.

I just want to confirm with you that adding these petct folders under lib and jars is the proper way to do things. If I am going to clean up my mess, I had better clean it up correctly.

Thanks,
Ilan

I think what Curtis meant is you should try to avoid creating a subfolder inside ./jars/, and instead put all your jar files into ./jars/ directlly.

I noticed that on your update site (http://sites.imagej.net/Ilan/), you are currently shipping plugins/lib/vecmath.jar. Please note that Fiji already includes a forked version of the vecmath project, jars/vecmath.jar (currently shipped by the Java-8 update site), that you could try to use to avoid version skew in the future. You can easily manage the versions of your dependencies by inheriting the Bill of Materials from pom-imagej in a Maven project.


I couldn’t find the source code for your plugins (only the compiled classes) on https://sourceforge.net/projects/bifijiplugins/files/, so if you’d like to get some help setting up your project dependencies with Maven, please share a link to the source code.

In the past I have noticed from time to time one of my library jar files was already in the fiji jars directory. Either I missed the vecmath.jar or it wasn’t there when I looked long ago.

The problem I can see is that somebody else might need a jar file which I am using and he needs a later version of it. Curtis already discovered a conflict in a version of the dcm4chee files which I need opposed to what bio-formats needs.

Maybe the real solution is for me to give control of all my “special” jar files (which aren’t at all special except I am the only one using them), to the control of the Fiji project. Then if I need to update one of them, I can contact the Fiji team.

The real reason for the petct folder was to make it apparent which plugin was “controlling” the files. If I give the control to Fiji, the problem doesn’t exist.

I have zero interest in using some outdated version of vecmath.jar or any other jar. In most cases I am using plain vanilla functions in these jar files, and if something in my program needs to be updated because of a later version of the library, I would be foolish not to update.

I want to try and make the cleanest change I can when cleaning up my mess.

2 Likes

You can do it that way. However, if you want each executable to be downloaded only on its correct platform, you will need to use the directory structure: lib/win32, lib/win64, lib/macosx, lib/linux32, lib/linux64. If you use lib/petct then all three executables will always be downloaded on all platforms.

These files are quite small and there are only 3 of them (the win32 works for win64 with no problem). They have slightly different names and it is my job anyway to pick up the correct one for the given OS.

My other question to you was what to do with the jar files in the jars directory? Is it better to have my jar files (used only by me) mixed in with everything else, or in a petct subfolder?

As I said above: better to put them directly into the jars folder.

Yes, they are mixed in the same directory. But the Updater can list which files came from each update site.