Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javafxpackager: how do you set the "base JDK"?

Tags:

javafx-8

When I run javafxpackager, I get the following warning/info:

No base JDK. Package will use system JRE.

It's not clear from the docs for Deploying JavaFX Applications how one would specify an alternative JDK. There isn't an option for it, that I can see (maybe I'm blind). Is it a system property?

Thanks.

like image 609
pfurbacher Avatar asked Jun 03 '14 21:06

pfurbacher


3 Answers

There is an old Oracle blog which mentions this. Don't know if it is still applicable or relevant to your case or not though:

Self-Contained Applications: Select Java Runtime to bundle

Packager tools in 7u6 assume current JDK (based on java.home property) is the source for embedded runtime. This is useful simplification for many scenarios but there are cases where ability to specify what to embed explicitly is handy. For example IDE may be using fixed JDK to build the project and this is not the version you want to bundle into your application.

To make it more flexible we now allow to specify location of base JDK explicitly. It is optional and if you do not specify it then current JDK will be used (i.e. this change is fully backward compatible).

New 'basedir' attribute was added to tag. Its value is location of JDK to be used. It is ok to point to either JRE inside the JDK or JDK top level folder. However, it must be JDK and not JRE as we need other JDK tools for proper packaging and it must be recent version of JDK that is bundled with JavaFX (i.e. Java 7 update 6 or later).

Here are examples ( is part of task):

<fx:platform basedir="${java.home}"/>      
<fx:platform basedir="c:\tools\jdk7"/> 

Hint: this feature enables you to use packaging tools from JDK 7 update 10 (and benefit from bug fixes and other features described below) to create application package with bundled FCS version of JRE 7 update 6.

like image 101
jewelsea Avatar answered Nov 15 '22 22:11

jewelsea


When run with the parameter -Bruntime:

javapackager.exe -Bruntime="c:\Program Files\Java\jdk1.8.0_76\jre\" ...

you get the following info:

Using base JDK at: c:\Program Files\Java\jdk1.8.0_76\jre

like image 8
Andrei Krasutski Avatar answered Nov 15 '22 23:11

Andrei Krasutski


In case it helps anyone, I wanted to use javapackager to bundle the 32-bit Java 8 JRE. I was running into issues because the JDK was the 64-bit Java 8 JDK. I was able to solve my issue by setting JAVA_HOME to the 32-bit JRE.

like image 5
Jon Onstott Avatar answered Nov 15 '22 23:11

Jon Onstott