The โBatch Packaging Cookbook for Fine-Tuning the Application Packageโ in the Oracle Java Deployment Team contains instructions on how to configure parts of the JRE to be included in a self-saved application.
I just copy and paste the appropriate section here if the original link does not work:
If you use packaging tools to create an installation package, you may need to customize the application image before it is completed by the installer. What for? For example, you might want to sign an application, so it does not seem unreliable for the OS (for example, to meet the requirements of Mac OS X Gatekeeper).
Also, by default, a stand-alone application does not contain a full copy of Java Runtime. We include only a set of required components. One of the reasons why this approach was taken is that we want to reduce the size of the packet. However, there are situations where your application may depend on these optional components, in which case you will need a way to add them to your private runtime. For example, https connections will not work if jre / lib / ext / sunjce_provider.jar is missing.
Currently, this can be achieved by providing a custom script configuration that runs after the application image is populated. As in the icon example above, you need to enable verbose output to find the script file name, and then drop it to the place where the packaging tools are found. Please note that the scripting language is also platform dependent. Currently, we only support the shell for Mac / Linux and the Windows script on Windows.
How do you know where the application image is located? Currently, user scripts are run in the directory where the configuration files are stored, but access to the application images can be obtained using the relative path to a specific platform. You can infer this path from verbose output, or by setting the JAVAFX_ANT_DEBUG environment variable to true to save intermediate build artifacts.
Here is an example script (contributed by John Petersen) that you can use to add jre / lib / ext / sunjce_provider.jar to the Windows MyApp application package. script using Javascript, but you can also use VBScript scripts for Windows.
<?xml version="1.0" ?> <package> <job id="postImage"> <script language="JScript"> <![CDATA[ var oFSO = new ActiveXObject("Scripting.FileSystemObject"); var oFolder = oFSO.getFolder("."); var from = oFolder.path + "\\MyApp\\app\\sunjce_provider.jar"; var to = oFolder.path + "\\MyApp\\runtime\\jre\\lib\\ext"; if (!oFSO.FolderExists(to)) { oFSO.CreateFolder(to); } to += "\\"; oFSO.CopyFile(from, to); ]]> </script> </job> </package>
In the discussion above, the sunjce_provider.jar file is sunjce_provider.jar from the JRE installation to the application package, but the procedure for copying any other file, including java.exe , should be similar.
For more information on how to create a custom package initially, see the JavaFX Deployment Guide .