Execute gradle tasks:
- generate keystore
$ ./gradlew genkeyor manually:
$ keytool -genkey -alias calc -keyalg RSA -keystore calc.jks -keysize 2048
$ cp calc.jks ~/.keystore- generate certificate
$ keytool -export -alias calc -keystore calc.jks -rfc -file calc.csrImportant: Add the certificate as a trusted one in Java Control Panel. For Mac: System Preferences > Java > Open Java Control Panel > Security tab > Manage certificates > User > Import. Import it possibly everywhere (trusted certificates, secure site etc.).
- create *.jnlp file with a signed jar
$ ./gradlew createWebstartIt will create webstart files at build/jnlp.
Copy the contents of build/jnlp to Tomcat's webapps/ROOT folder.
Go to Tomcat's bin folder and execute startup script.
$ cd /opt/apache-tomcat-9.0.8/bin
$ ./startup.shNote: check if Tomcat is running with ps -ef | grep tomcat and eventually kill the kitten: pkill -9 -f tomcat.
Shorten: ./killtomacat.sh
In web browser:
http://localhost:8080/launch.jnlp
It will download the jnlp file. Execute it and enjoy the calculator.
Commands I found useful:
Sign jar manually:
jarsigner -keystore ../../../calc.jks -storepass hania123 -keypass hania123 lab8__V1.0-SNAPSHOT-calc.jar calcUnpack *.pack.gz file for whatever reason:
unpack200 *.jar.pack.gz *.jar