Login  Register

Here is how to do multi-platfrom deployment

Posted by douglaslyon on Jan 10, 2018; 12:11pm
URL: https://forum.jogamp.org/Here-is-how-to-do-multi-platfrom-deployment-tp4038517.html


Our approach to deployment of the new Java 3D libraries is to create a
single extension to the jnlp resources, called "jogl.jnlp". This makes
direct reference to bundled native libraries as well as Java3D jars.
What follows is the listing for the "jogl.jnlp":

<jnlp spec="1.0+"
  codebase="http://show.docjava.com:80/book/cgij/code/jnlp/">
  <information>
      <title>Java 3D</title>
      <vendor>DocJava Inc.</vendor>
      <homepage href="http://www.docjava.com"/>
      <description>Java 3D library</description>
   </information>

   <security>
     <all-permissions/>
   </security>
<resources>
       <jar href="libs/jogl/j3dcore.jar" download="eager"/>
       <jar href="libs/jogl/j3dutils.jar"  download="eager"/>
       <jar href="libs/jogl/vecmath.jar"  download="eager"/>
       <jar href="libs/jogl/jogamp-fat.jar"     download="eager"/>
</resources>
     <component-desc />
</jnlp>


The j3dcore.jar, j3dutils.jar and vecmath.jar are pure Java code. Native
methods for the common platforms (Windows 64, Windows 32, Linux 64,
Linux 32 and the Mac) are all placed in the jogamp-fat.jar. A JNLP that
launches a jogl application follows:

<jnlp spec="1.0+"
  codebase="http://show.docjava.com:80/book/cgij/code/jnlp/"><information>
     <title>j3d.JOGLQuad</title>
     <vendor>DocJava, Inc.</vendor>
     <homepage href="http://www.docjava.com"/>
     <icon href="http://show.docjava.com:80/consulti/docjava.jpe"/>
     <offline-allowed />
   </information>

   <security>
     <all-permissions />
   </security>

   <resources>
<j2se version="1.8+" initial-heap-size="64m" max-heap-size="384m"
java-vm-args="
--add-exports=java.base/java.lang=ALL-UNNAMED
--add-exports=java.desktop/sun.awt
=ALL-UNNAMED --add-exports=java.desktop/sun.java2d=ALL-UNNAMED"/>
     <extension name="Java3D"  href="jogl.jnlp"></extension>
     <jar href="joglquad.jar" />
   </resources>

   <application-desc main-class="j3d.JOGLQuad" />
</jnlp>

Here we we the common extensions for jogl support, <extension
name="Java3D"  href="jogl.jnlp"></extension>. This enables a common
deployment to all Java3D and JOGL based programs. Also, most critical to
proper operation, the J2SE tag:

<j2se version="1.8+" initial-heap-size="64m" max-heap-size="384m"
java-vm-args="
--add-exports=java.base/java.lang=ALL-UNNAMED
--add-exports=java.desktop/sun.awt
=ALL-UNNAMED --add-exports=java.desktop/sun.java2d=ALL-UNNAMED"/>

The "--add-exports" is part of the new-style module arguments. For example:

--add-exports=java.base/java.lang=ALL-UNNAMED

follows the pattern: --add-exports <source-module>/<package>=<target-module>

where <source-module> is "java.base", <package> is "java.lang" and
<target-module> is "ALL-UNNAMED". The "ALL-UNNAMED" enables all modules
to access all classes in java.lang. In the case of legacy code, all the
modules will be unnamed.

As webstart applications must be signed before modern Java will run
them, we have authored a collections of articles that guide the reader
through the signing process [Lyon, 2004a,b, 2008].

The signed jar files are all available from:
https://tinyurl.com/signedJars

Full text of the below articles cited are available from the authors web
site at http://www.docjava.com

[Lyon 2004a] “Project Initium: Programmatic Deployment” by Douglas A.
Lyon, Journal of Object Technology, vol. 3, no. 8, September-October
2004, pp. 55-69.

[Lyon 2004b] “The Initium X.509 Certificate Wizard” by Douglas A. Lyon,
Journal of Object Technology, vol. 3, no. 10, November-December 2004,
pp. 75-88.

[Lyon 2008] “I Resign! Resigning Jar Files with Initium”, by Douglas A.
Lyon, Journal of Object Technology, vol. 7, no. 4, April-May 2008, pp. 9-27.

Cheers!
  - Doug


On 1/9/18 9:10 PM, Predrag Bokšić [via jogamp] wrote:

> GOOD NEWS! I don't know if you have updated any code in the meantime,
> but this JNLP execution works on KUbuntu 16 with all the latest updates
> and the Oracle JDK 9, and with the Oracle JDK 8 separately. The last
> time I checked from the same operating system in a virtual machine, it
> displayed an empty canvas inside a window. Now I am on a real machine,
> and everything works as expected, including my off-line projects.
>
> Douglas, will you find the time - its no hurry - to perhaps, pack and
> send a directory with the jar and jnlp files? I think that I understood
> everything that you are saying, but can you imagine someone coming from
> Google in 3 years time to this thread utterly confused about the thing
> he/she should copy-paste :-)
>
>
> Here's some "statistics" to keep the engineer's mentality going.
>
>
> VM arguments:
> --add-modules=ALL-DEFAULT,javafx.deploy -Xverify:remote
> -Djava.security.manager
> -Djava.security.policy=file:/usr/lib/jvm/java-9-oracle/conf/security/javaws.policy
> -DtrustProxy=true -Xverify:remote
> -Djnlpx.home=/usr/lib/jvm/java-9-oracle -Djava.security.manager
> -Djnlpx.origFilenameArg=/home/gamma/idea/classy/joglquad polished.jnlp
> -Djnlpx.remove=false --add-exports=java.base/java.lang=ALL-UNNAMED
> --add-exports=java.desktop/sun.awt=ALL-UNNAMED
> --add-exports=java.desktop/sun.java2d=ALL-UNNAMED -Xms64m -Xmx384m
> -Djnlpx.heapsize=64m,384m
> -Djnlpx.jvm=/usr/lib/jvm/java-9-oracle/bin/java
> -Djnlpx.vmargs=LS1hZGQtZXhwb3J0cz1qYXZhLmJhc2UvamF2YS5sYW5nPUFMTC1VTk5BTUVEAC0tYWRkLWV4cG9ydHM9amF2YS5kZXNrdG9wL3N1bi5hd3Q9QUxMLVVOTkFNRUQALS1hZGQtZXhwb3J0cz1qYXZhLmRlc2t0b3Avc3VuLmphdmEyZD1BTEwtVU5OQU1FRAA=
> --illegal-access=deny --add-modules=ALL-DEFAULT
> --add-exports=java.base/com.sun.net.ssl.internal.ssl=jdk.deploy
> --add-exports=java.base/jdk.internal.misc=jdk.deploy
> --add-exports=java.base/jdk.internal.util.jar=jdk.deploy
> --add-exports=java.base/sun.net.www=jdk.deploy
> --add-exports=java.base/sun.net.www.protocol.file=jdk.deploy
> --add-exports=java.base/sun.net.www.protocol.http=jdk.deploy
> --add-exports=java.base/sun.net.www.protocol.http.ntlm=jdk.deploy
> --add-exports=java.base/sun.net.www.protocol.https=jdk.deploy
> --add-exports=java.base/sun.net.www.protocol.jar=jdk.deploy
> --add-exports=java.base/sun.nio=jdk.deploy
> --add-exports=java.base/sun.reflect.misc=jdk.deploy
> --add-exports=java.base/sun.security.action=jdk.deploy
> --add-exports=java.base/sun.security.pkcs=jdk.deploy
> --add-exports=java.base/sun.security.provider=jdk.deploy
> --add-exports=java.base/sun.security.provider.certpath=jdk.deploy
> --add-exports=java.base/sun.security.rsa=jdk.deploy
> --add-exports=java.base/sun.security.ssl=jdk.deploy
> --add-exports=java.base/sun.security.timestamp=jdk.deploy
> --add-exports=java.base/sun.security.util=jdk.deploy
> --add-exports=java.base/sun.security.validator=jdk.deploy
> --add-exports=java.base/sun.security.x509=jdk.deploy
> --add-exports=java.base/sun.usagetracker=jdk.deploy
> --add-exports=java.desktop/sun.awt=jdk.deploy
> --add-exports=java.naming/com.sun.jndi.toolkit.url=jdk.deploy
> --add-exports=java.base/jdk.internal.misc=jdk.javaws
> --add-exports=java.desktop/com.sun.media.sound=jdk.javaws
> --add-exports=java.desktop/sun.awt=jdk.javaws
> --add-exports=java.desktop/sun.awt.image=jdk.javaws
> --add-exports=java.base/jdk.internal.misc=jdk.plugin
> --add-exports=java.base/sun.net=jdk.plugin
> --add-exports=java.base/sun.net.www=jdk.plugin
> --add-exports=java.base/sun.net.www.protocol.jar=jdk.plugin
> --add-exports=java.base/sun.security.action=jdk.plugin
> --add-exports=java.base/sun.security.util=jdk.plugin
> --add-exports=java.desktop/com.sun.media.sound=jdk.plugin
> --add-exports=java.desktop/java.awt.peer=jdk.plugin
> --add-exports=java.desktop/sun.applet=jdk.plugin
> --add-exports=java.desktop/sun.applet.resources=jdk.plugin
> --add-exports=java.desktop/sun.awt=jdk.plugin
> --add-exports=java.desktop/sun.awt.windows=jdk.plugin
> --add-exports=java.desktop/sun.swing=jdk.plugin
> --add-exports=jdk.jsobject/jdk.internal.netscape.javascript.spi=jdk.plugin
> --add-exports=java.desktop/sun.awt.X11=jdk.plugin
> --add-exports=java.desktop/sun.print=jdk.plugin
> -Djdk.module.main=jdk.plugin
>
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://forum.jogamp.org/Jogl-Jogamp-on-Java-9-tp4038012p4038515.html
> To unsubscribe from Jogl/Jogamp on Java 9, click here
> <
> NAML
> <
http://forum.jogamp.org/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>