Self-Contained Application Packaging for a JavaFX app on Windows: InnoSetup OR javafxpackager?

拜拜、爱过 提交于 2019-12-08 12:19:00

问题


Steam does not accept to launch a batch file that installs (with an installer) a specific JRE and then launches my app on it. So, for avoiding this problem, I want to create a "self contained app packaging" and provides a "simple" .exe to Steam, this file including the JRE and my app.

I saw https://docs.oracle.com/javafx/2/deployment/self-contained-packaging.htm#A1324980 but it is a little bit complicated. I only noticed that Innosetup could help me to generate this .exe file.

But another solution cold be to use javafxpackager (from C:\Program Files\Java\jdk1.8.0_xxx\bin)

Does anyone have experience of generating an executable with innosetup and javafxpackager in order to share it with the community, especially in the Steam context? What are the traps to avoid when the ouput file is generated?

Thanks

Note: At this time, innosetup and jdk1.8.0_191 (including javapackager.exe) are installed respectively in C:\Program Files (x86)\Inno Setup 5 and C:\Program Files\Java\jdk1.8.0_191 . In a dedicated folder (steam_hg), I have the app (hg.jar) that can be launched from the JRE.

Note: Here is an example of batch file that installs the JRE (if necessary) and then launches the app:

@echo off

REM The game only works on 64 bits
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set OS=32BIT || set OS=64BIT
echo %OS%
if %OS%==32BIT echo Windows is a 32bits operating system. Hyper Galactica only works on Windows 64 bits
if %OS%==32BIT goto fin
if %OS%==64BIT echo Hyper Galactica for Windows 64bits.

REM JRE installer, if it is necessary
if exist jre1.8.0 (echo jre already installed in the jre1.8.0 folder)
if not exist jre1.8.0 (
echo installer command for 1.8.0.191 jre
jre-8u191-windows-x64 /s INSTALLDIR=%~dp0jre1.8.0
)

REM launch the game
start %~dp0jre1.8.0\bin\java.exe -classpath %~dp0 -jar hg.jar

:fin

来源:https://stackoverflow.com/questions/53767622/self-contained-application-packaging-for-a-javafx-app-on-windows-innosetup-or-j

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