java - Writing a Unix installer for a Jar file -
i have written java application, , have created executable jar file runs application java -jar myjar.jar
. have executable shell script called launchmyprogram
wraps launching of jar (and offers various flags --help etc.). target output directory looks this:
$ ls /path/to/myproject/target/ archive-tmp/ classes/ myjar.jar
what standard method me write installer unix-only application? assume correct drop launchmyprogram
executable in /usr/local/bin. put jar file? should make own subdirectory somewhere program's files? need copy classes
directory above output same directory jar? run via makefile of course users may override choices.
basically, want user able run make && make install
, , able run application launchmyprogram
, , want place files (one jar, 'classes' folder, , shell script) in typical places possible.
one of best ways has been reinvented many times unfortunately not yet standard.
since jar zip file allowed have arbitrary prefix, can prepend launcher shell script jar, mark executable, , treat standalone binary.
$ echo '#!/bin/bash' > launchmyprogram $ echo 'exec java -cp "${0}" com.example.program.main "${@}"' >> launchmyprogram $ cat myjar.jar >> launchmyprogram $ chmod +x ./launchmyprogram $ ./launchmyprogram hello, world!
see simple & easy executable jars more details.
you should able pack in classes/
folder jar , still have things work.
also, if want provide rpms or deb packages or users, fpm
makes easy.
Comments
Post a Comment