Basically, if I have multiple jar files, some of which are signed by a different certificate, then we need to create separate jnlp files for these resources.
TLDR - Signing each jar with the same certificate, seems to work, regardless if it has been signed before.
The section in the jnlp file that contains:
<jar href="lib/Utilities.jar"/>
should be replaced with:
<extension name="Java Utilities" href="utilities_launch.jnlp"/>
and we then need another jnlp file, named utilities_launch.jnlp such as:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" href="utilities_launch.jnlp">
<information>
<title>Java Utilities</title>
<vendor>Harry Nisbet</vendor>
</information>
<security>
<all-permissions/>
</security>
<resources>
<jar href="lib/Utilities.jar"/>
</resources>
<component-desc/>
</jnlp>
So as an example for my Peon application;
Also see below for a live version;
peon.jnlp which exists on the local machine:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp codebase="http://172.16.144.252/stuff/peon/" href="launch.jnlp" spec="1.0+">
<information>
<title>Peon</title>
<vendor>Harry Nisbet</vendor>
<homepage href=""/>
<description>Peon</description>
<description kind="short">Peon</description>
<icon href="peon.png" kind="splash"/>
</information>
<update check="always"/>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.8+"/>
<jar href="Peon.jar" main="true"/>
<jar href="lib/postgresql-42.2.8.jar"/>
<extension name="Java Utilities" href="utilities_launch.jnlp"/>
</resources>
<application-desc main-class="peon.Form1">
</application-desc>
</jnlp>
launch.jnlp which exists on the server:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp href="launch.jnlp" spec="1.0+">
<information>
<title>Peon</title>
<vendor>Harry Nisbet</vendor>
<homepage href=""/>
<description>Peon</description>
<description kind="short">Peon</description>
<icon href="peon.png" kind="splash"/>
</information>
<update check="always"/>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.8+"/>
<jar href="Peon.jar" main="true"/>
<jar href="lib/postgresql-42.2.8.jar"/>
<extension name="Java Utilities" href="utilities_launch.jnlp"/>
</resources>
<application-desc main-class="peon.Form1">
</application-desc>
</jnlp>
and finally the utilities_launch.jnlp file which exists beside the launch.jnlp file above:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" href="utilities_launch.jnlp">
<information>
<title>Java Utilities</title>
<vendor>Harry Nisbet</vendor>
</information>
<security>
<all-permissions/>
</security>
<resources>
<jar href="lib/Utilities.jar"/>
</resources>
<component-desc/>
</jnlp>
A live example from my Peon application on server;
Contents of readme.txt
1 Create a folder on local pc
2 Download the peon.jnlp file into said folder.
3 Create a shortcut to said peon.jnlp file and place it on Desktop.
4 Profit.
5 Profit more...
Contents of readme2.txt
peon.jnlp should be on desktop or in its own folder.
launch.jnlp should be on server beside the jar file and lib folder.
utilities_launch.jnlp file should be beside the launch.jnlp file above.
Contents of index.html
<HTML>
<meta http-equiv="Refresh" content="n;getpeon.bat">
<p><center>
<a href="getpeon.bat">If download doesnt start automatically, click here!</a>
</center></p>
</HTML>
Contents of getpeon.bat
mkdir Peon
cd peon
powershell -Command "(New-Object Net.WebClient).DownloadFile('http://172.16.144.252/stuff/peon/peon.jnlp', 'peon.jnlp')"
cd ..
del -f getpeon.bat
Contents of peon.jnlp
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp codebase="http://172.16.144.252/stuff/peon/" href="launch.jnlp" spec="1.0+">
<information>
<title>Peon</title>
<vendor>Harry Nisbet</vendor>
<homepage href=""/>
<description>Peon</description>
<description kind="short">Peon</description>
<icon href="peon.png" kind="splash"/>
</information>
<update check="always"/>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.8+"/>
<jar href="Peon.jar" main="true"/>
<jar href="lib/postgresql-42.2.8.jar"/>
<extension name="Java Utilities" href="utilities_launch.jnlp"/>
</resources>
<application-desc main-class="peon.Form1">
</application-desc>
</jnlp>
Contents of launch.jnlp
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp href="launch.jnlp" spec="1.0+">
<information>
<title>Peon</title>
<vendor>Harry Nisbet</vendor>
<homepage href=""/>
<description>Peon</description>
<description kind="short">Peon</description>
<icon href="peon.png" kind="splash"/>
</information>
<update check="always"/>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.8+"/>
<jar href="Peon.jar" main="true"/>
<jar href="lib/postgresql-42.2.8.jar"/>
<extension name="Java Utilities" href="utilities_launch.jnlp"/>
</resources>
<application-desc main-class="peon.Form1">
</application-desc>
</jnlp>
Contents of utilities_launch.jnlp
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" href="utilities_launch.jnlp">
<information>
<title>Java Utilities</title>
<vendor>Harry Nisbet</vendor>
</information>
<security>
<all-permissions/>
</security>
<resources>
<jar href="lib/Utilities.jar"/>
</resources>
<component-desc/>
</jnlp>
No comments:
Post a Comment
Note: only a member of this blog may post a comment.