Paul Taylor
Paul Taylor

Reputation: 13130

Can you use Java JPackage to create own Windows installer without using its way of running application

Background, I currently use Izpack for my Windows installer, I bundle a java runtime and use winrun4j as a wrapper both for the installation and the actual program once installed. It worked for a long time but there are a number of problems with the installer that I have not been able to solve and have been looking to replace it.

Oracle now provide the JPackage installer so it seems like a sensible choice. But the folder structure created by the installer is different to what I currently have, I have a number of config and non java files and I have not been able to get the .exe that JPackage creates to do anything.

So is it possible to use JPackage to create the installer but in a strcuture better matching my existing structure, and use continue to use WInRun4j to actyally run my application

Existing Folder Structure

ROOT
---App.exe
---Config Files
---lib
-------jar files
---JVM64
------- Java runtime
---help

JPackage structure

ROOT
---App.exe
---Runtime Dlls
---app
----- jar files
      Config files
--runtime
------Java runtime
------Runtime Dlls (again)

Upvotes: 0

Views: 1530

Answers (1)

DuncG
DuncG

Reputation: 15196

The structure of directories generated by jpackage is mainly set up for you and does not seem possible to change, and makes installation of Java app dependencies very easy with self contained JRE. The basic structure for Windows is as you say:

ROOT
---App.exe (for --main-class parameter) 
---xyz.exe (for each --add-launcher parameter)
---Runtime Dlls (these appear to be unused except for applauncher.dll, see SO 62607300)
---app/
------App.cfg (for --main-class)
------xyz.cfg (for per --add-launcher)
---runtime/
------Java runtime
------Runtime Dlls

With --input and --main-jar params you are free to setup additional directory structure under app/ folder for anything else you want for your application. So if you used lib/myappjar.jar it would add:

---app/
-------lib/
----------myappjar.jar

If you used --input build\mypath it would copy the entire tree of files under that folder, so if build\mypath dir contained

bin/
---Scripts
---xyz.properties
README.txt

Then app would also contain:

---app/
------bin/
---------Scripts
---------xyz.properties
------README.txt

By the way the Runtime DLLs placed at top level appear to be copies of some of the DLLs under runtime/bin [https://stackoverflow.com/questions/62607300/why-is-java-jpackage-installing-windows-dll-files-in-two-places]

Upvotes: 2

Related Questions