Javafxpackager: how do you set the “base JDK”?

自古美人都是妖i 提交于 2019-12-06 18:40:43

问题


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.


回答1:


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.




回答2:


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




回答3:


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.




回答4:


I have just solved same problem:

NetBeans ID - Tools - NetBeans Platform Manager - "Sources" tab

button Add ZIP/Folder

(there were no sources set so I set it and "No base JDK. Package will use system JRE." disappeared)



来源:https://stackoverflow.com/questions/24025309/javafxpackager-how-do-you-set-the-base-jdk

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!