Skip to content

Signed calculator application shared with JavaWS and Tomcat

Notifications You must be signed in to change notification settings

hvvka/web-start

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f18f00e · Nov 3, 2018

History

4 Commits
May 9, 2018
May 9, 2018
May 10, 2018
May 9, 2018
May 9, 2018
May 16, 2018
Nov 3, 2018
May 16, 2018
May 16, 2018
May 16, 2018
May 9, 2018
May 9, 2018
May 10, 2018
May 9, 2018

Repository files navigation

web-start

Deploy

Execute gradle tasks:

  • generate keystore
$ ./gradlew genkey

or 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.csr

Important: 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 createWebstart

It will create webstart files at build/jnlp.

Start

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.sh

Note: 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 calc

Unpack *.pack.gz file for whatever reason:

unpack200 *.jar.pack.gz *.jar