d ei
d ei

Reputation: 555

How do I configure install4j to run a java executable jar file which contains other jar files?

I have java an executable jar file that has many other jar files embedded in it. It uses simon tuffs onejar to accomplish this. The jar runs correctly when I double-click it, or issue 'java -jar myApp.jar' from the command prompt. The jar file has a manifest.mf containing:

Manifest-Version: 1.0
Main-Class: com.simontuffs.onejar.Boot
One-Jar-Expand: expand,doc

Install4j correctly copies this jar file to my bin folder, but the 'myApp.exe' that it creates fails to launch. I get:

java.lang.ClassNotFoundException: com.ndi.foreCee.programs.MyApp

or:

java.lang.ClassNotFoundException: com.simontuffs.onejar.Boot

depending on what I plug into install4j's Configure Java invocation page 'Main class'. I've set 'Class path:' to 'Archive bin\myApp.jar'.

Can anyone tell how to configure install4j to build an exe that just issues 'java -jar myApp.jar', using the embedded jre?

Upvotes: 2

Views: 2241

Answers (3)

d ei
d ei

Reputation: 555

I solved my problem by updating my ant build and removing simon tuffs one-jar and replacing it with: as described in Including external jar-files in a new jar-file build with Ant . After that, the Install4J launcher worked as advertised (and as M2E67 described).

Upvotes: 0

M2E67
M2E67

Reputation: 970

Add a "Run executable or batch file" action to the "Installation screen" and set the following properties:

"Executable" property: ${installer:sys.javaHome}/bin/java

"Arguments" property: -jar; filename.jar (in the editor one argument per line)

Install4j : How to execute command line java -jar filename.jar at the end of installation

Upvotes: 4

Ingo Kegel
Ingo Kegel

Reputation: 48005

Can anyone tell how to configure install4j to build an exe that just >issues 'java -jar myApp.jar', using the embedded jre?

The launcher generated by install4j does not execute javaat all, it uses JNI to create the JVM.

You can start the executable from the command line with the parameter /create-i4j-log to get a log file that shows the parameters that are passed to the JVM.

Upvotes: 0

Related Questions