2

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?

d ei
  • 493
  • 4
  • 16

3 Answers3

4

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

M2E67
  • 937
  • 7
  • 23
0

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.

Ingo Kegel
  • 46,523
  • 10
  • 71
  • 102
0

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).

d ei
  • 493
  • 4
  • 16