'How can I make executable file from jar with embedded JVM?
For example, I have someFile.jar. I can run it simply using java -jar someFile.jar.
But I want to create some files (for example .deb file) to install this jar to another machine. This machine may not have jre15 which is required for running this jar. So I want to create some executable file that will contain jar and JVM
I tried to use jpackage --name testName --input . --main-jar someFile.jar --linux-shortcut. This command generates `.deb file but it won't create terminal command testName (to run this jar) but it creates a desktop app that I can run as an application but no one terminal command created. So, how can I create a deb file from the jar with embedded JVM to be able to run it as a command from terminal?
Solution 1:[1]
Investigate the content of the deb, or investigate the filesystem once the package is installed. Per default you should find it in /opt/. Underneath that you find a bin directory with only one file. That is the one you can invoke from command line.
JPackage also creates a launcher, which resides in /opt//lib/*.desktop. Check that text and you see that the executable is just the file in the bin directory, which means the GUI will run that exact command when the icon is clicked.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Hiran Chaudhuri |
