4 ms·
This sort of installer should only be required for apps that require some native code and/or tight integration with the Desktop Environment. For most other pur
by hrjet 12y ago
This sort of installer should only be required for apps that require some native code and/or tight integration with the Desktop Environment.
For most other purposes, a simple .jar or .jnlp file works fine.
- mbreese 12y agoSimple JARs and JNLP files have a very poor user experience. No one knows what to do with them. If you click a web-start link, your browser might start up your app, or download the jnlp file. If it just downloaded the file, you now have another few steps: 1) find the newest jnlp file, and 2) click it. Naked JAR files aren't much better. In order to best integrate with the OS, you will probably have some runtime-specific settings that you'd like to apply (such as memory, or GUI specific-settings). If you just distribute a JAR, that can't be easily set. For Linux and Mac (command-line only) I've gotten into the habit wrapping up a JAR in a shell script to make one single file to distribute. The shell script can set all of the JVM flags that I need, and it can be run just like any executable. This doesn't solve the problem of adding icons, or the like for GUIs, but for command-line programs, it works great.
- electrum 12y ago> For Linux and Mac (command-line only) I've gotten into the habit wrapping up a JAR in a shell script There is a Maven plugin to do this: https://github.com/brianm/really-executable-jars-maven-plugin https://github.com/brianm/really-executable-jars-maven-plugi... We use it for things like the Presto CLI.
- gizmo686 12y ago>For Linux and Mac (command-line only) Why is this specific to Linux/Mac and command line. Windows has .bat files which can accomplish the same goal, and every filemanager I have used will recognize a script file and execute it when you try opening it.
- krakensden 12y agoCan you do the trick where the actual binary is embedded in the .sh with batch files? I think that's what he's talking about.
- mbreese 12y agoExactly... I was talking about cat'ing the JAR file to a shell script. It's a pretty simple ant or maven task. (Or just 'cat script.sh myjar.jar > executable') I don't know if this works on Windows or not... Never tried - it's been a long time since I've used Windows. And even then, if I needed to do command line work, I would install Cygwin. I don't know why it wouldn't work with batch files though. Do they get a reference to their own name as an argument?
- girvo 12y agoAs far as I remember, yes you can, but it required an external tool to do it.
- userbinator 12y agoIn order to best integrate with the OS, you will probably have some runtime-specific settings that you'd like to apply (such as memory, or GUI specific-settings). If you just distribute a JAR, that can't be easily set. The simplest solution is to have the JAR itself do this, relaunching the JVM if necessary. Packr itself is distributed as a single JAR file, which I find a bit ironic.