I have created a ImageJ-plugin project in Eclipse with an appropriate
"launch configuration". The project includes the ij.jar as a "referenced library". The launch configuration runs perfectly in the Eclipse environment, but when I try to export a runnable-JAR file I get the following error: "Could not find main method from given launch configuration." and indeed the project will not run in Java (here is an attempt at the command prompt): C:\Users\Richard VanMetter\Desktop>java -jar MFPPD52a.jar no main manifest attribute, in MFPPD52a.jar Here is the manifest when ij is included as a folder in the JAR file: Manifest-Version: 1.0 Class-Path: . which has no reference to main method. Here is the manifest when ij is included as a jar in the project JAR file: Manifest-Version: 1.0 Rsrc-Class-Path: ./ ij.jar Class-Path: . In both cases, I tried adding the following line to the manifest manually Main-Class: ij.ImageJ The contents of the JAR file include, the classes written for my project plus the following: ij (either as a jar file or unzipped as a folder, depending on export libraries option) META-INF folder org folder but, it still will not run either by double-clicking, or in a command window via either of these commands: C:\Users\Richard VanMetter\Desktop>java -jar MFPPD52a.jar Error: Could not find or load main class ij.ImageJ C:\Users\Richard VanMetter\Desktop>javaw -jar MFPPD52a.jar ij.ImageJ (no error message, but no run either) For completeness, the following works fine: C:\Program Files (x86)\ImageJ>javaw -jar ij.jar ij.ImageJ Has anyone experienced this problem? and know a solution? Thanks to all, Rich VanMetter -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Rich,
> I have created a ImageJ-plugin project in Eclipse with an appropriate > "launch configuration". My advice is to use Maven and pattern your plugin after this project: https://github.com/imagej/minimal-ij1-plugin Then you can build the JAR in a variety of contexts, rather than only Eclipse. I tested exporting a "runnable JAR" from Eclipse with the "Extract required libraries into generated JAR" option, and that also works. The difference is that this option (as well as "Package required libraries into generated JAR") creates a standalone "uber-JAR" [1] rather than a JAR containing only your classes. Doing that inherits several serious disadvantages, though [2]. Regards, Curtis [1] http://stackoverflow.com/q/11947037 [2] http://imagej.net/Frequently_Asked_Questions#How_can_I_call_ImageJ_from_my_software.3F On Fri, Jan 9, 2015 at 8:57 AM, Richard VanMetter <[hidden email]> wrote: > I have created a ImageJ-plugin project in Eclipse with an appropriate > "launch configuration". The project includes the ij.jar as a "referenced > library". The launch configuration runs perfectly in the Eclipse > environment, but when I try to export a runnable-JAR file I get the > following error: > "Could not find main method from given launch configuration." > and indeed the project will not run in Java (here is an attempt at the > command prompt): > C:\Users\Richard VanMetter\Desktop>java -jar MFPPD52a.jar > no main manifest attribute, in MFPPD52a.jar > > Here is the manifest when ij is included as a folder in the JAR file: > Manifest-Version: 1.0 > Class-Path: . > which has no reference to main method. > > Here is the manifest when ij is included as a jar in the project JAR file: > Manifest-Version: 1.0 > Rsrc-Class-Path: ./ ij.jar > Class-Path: . > > In both cases, I tried adding the following line to the manifest manually > Main-Class: ij.ImageJ > The contents of the JAR file include, the classes written for my project > plus the following: > ij (either as a jar file or unzipped as a folder, depending on > export libraries option) > META-INF folder > org folder > > but, it still will not run either by double-clicking, or in a command > window via either of these commands: > C:\Users\Richard VanMetter\Desktop>java -jar MFPPD52a.jar > Error: Could not find or load main class ij.ImageJ > > C:\Users\Richard VanMetter\Desktop>javaw -jar MFPPD52a.jar > ij.ImageJ > (no error message, but no run either) > > For completeness, the following works fine: > C:\Program Files (x86)\ImageJ>javaw -jar ij.jar ij.ImageJ > > > Has anyone experienced this problem? and know a solution? > > Thanks to all, > > Rich VanMetter > > -- > 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 |