B4J Tutorial [Server] Packaging OpenJDK for Server App

Discussion in 'B4J Tutorials' started by tchart, Apr 23, 2019.

  1. tchart

    tchart Active Member Licensed User

    I couldn't find this on the forum but if you are looking to package your server (non-UI) app with Java 11 (OpenJDK) then you should be aware there is no JRE per se.

    I came across an article (link below) a few weeks back which helped me package a "JRE" for my server application;

    From your JDK 11 distribution;
    1. Delete the jmods directory. This eliminates about 74 MB.
    2. Delete the lib/src.zip to save an additional 45+ MB.
    The end result is a "...modified JDK 11 runtime consumes about 157 MB, nearly 40 MB smaller than typical Java 8 JREs".

    Original article; https://dzone.com/articles/no-more-jre-packaging-no-big-deal-1

    Important note; although I was able to start my app up with just the bin & lib folders it would fail when trying to bind the SSL certificate - the reason is that the security policies are under the "conf\security" directory. You need to include the conf folder. Just in case anyone runs into the same problem the error is below;

    Code:
    java.io.IOException: Invalid keystore format
        at java.base/sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:
    659)
        at java.base/sun.security.util.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:
    222)
        at java.base/java.security.KeyStore.load(KeyStore.java:
    1479)
        at org.eclipse.jetty.util.security.CertificateUtils.getKeyStore(CertificateUtils.java:
    54)
        at org.eclipse.jetty.util.ssl.SslContextFactory.loadKeyStore(SslContextFactory.java:
    1071)
        at org.eclipse.jetty.util.ssl.SslContextFactory.load(SslContextFactory.java:
    262)
        at org.eclipse.jetty.util.ssl.SslContextFactory.doStart(SslContextFactory.java:
    229)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice