Reputation: 370
i developed a java console application with the help of maven for my dependency management. The application is a pure console application, which means the user has to call it via the comandline and has to give parameters with it. I need to bundle the finiheD jar (with dependencies produced by maven-assembly-plugin) with an complete JRE, because the application has to be able to work on machines without java pre installed.
I tried to use the java packager -deploy command on the finished jar, but it doesnt really work: https://docs.oracle.com/javase/9/tools/javapackager.htm#JSWOR719
C:\jdk-9.0.4\bin>javapackager.exe -deploy -srcdir C:\folderwithjarinside -outdir C:\outdir -name Toolname -native -appclass [..].core.Main
After that i get a bundle with the jar, the complete jre and an exe to start the whole thing:
When i now start the exe nothing happens and when i start it from an command line again nothing happens and i dont even get console output which SHOULD happen. When i start the jar allone i get console output even when i dont give parameters and it crashes cause of it.
How do i package my java console application with the JRE and are still able to start it as commandline application provide arguments and see console output?
Thanks in advance
Upvotes: 2
Views: 3418
Reputation: 842
Multiple tools exist for packaging the JRE with your application:
I am pretty sure that neither launch4j nor the JDK support cross-platform builds for the installer, i.e. in your deployment toolchain, you need a machine with each target OS for each platform that you wish to have an installer for.
install4j isn't ideal in this respect, but at least you need the other-platform machines just once to create the JRE bundle.
Upvotes: 2