Can we use JavaPackager and a get full JRE?

Jeff Martin jeff at
Sun Aug 9 18:47:38 UTC 2015

You can add a post-image script to your javapackager build to manually add the java.exe into your application. If you search the output from the javapackager for “post-image” I think it will tell you what file to create and where to put it. Here is a post-image file that I use to move java.exe into my native app on Windows:


<?xml version="1.0" ?> 
  <job id="postImage"> 
    <script language="JScript"> 
        var oFSO = new ActiveXObject("Scripting.FileSystemObject"); 
        var oFolder = oFSO.getFolder("."); 
        var from = "C:\\Program Files\\Java\\jdk1.8.0_40\\bin\\java.exe"; 
        var to = oFolder.path + “\\MyApp\\runtime\\bin"; 
        if (!oFSO.FolderExists(to)) { 
        to += "\\";
        oFSO.CopyFile(from, to); 

On MacOS, I just build a native “image” as opposed to a .dmg. So it’s easy to add the java binary in an external script (I do some codesign stuff there as well, which has to happen after I modify the native package).

Jeff Martin

> On Aug 8, 2015, at 6:16 PM, Scott Palmer <swpalmer at> wrote:
> I’m using the JavaFX gradle plugin to build a very simple application with the new java packager and I’ve noticed a problem with the embedded JRE, at least on OS X.
> Specifically, the ‘bin’ folder is missing from the embedded JRE, presumably because the embedded launcher replaces it.
> However my application (and many others) needs to launch a new java process.  Part of the reason for doing so is so it can be launched with new JVM options that are determined at runtime.  For example modifying the java.library.dir after finding “plugins” that have native code.
> Now it fails when running from the app bundle (works fine from a command line).  The problems is that it fails to launch a new ‘java’ process because it expects to find 'bin/java' in the JRE folder.
> What is the solution?
> Since I’m using Gradle, I’m thinking I could tweak things to copy the JRE bin folder into the folder, but really the javapackager should have an option to include the “full” JRE.
> Or perhaps we need a new API in Java 9 to support launching a new Java process?
> Regards,
> Scott

More information about the openjfx-dev mailing list