openjfx-docs icon indicating copy to clipboard operation
openjfx-docs copied to clipboard

custom jdkfx image instructions

Open skaviouz opened this issue 4 years ago • 0 comments

https://openjfx.io/openjfx-docs/modular.html#JDK-FX https://github.com/openjfx/openjfx-docs/blob/master/modular.html Keep in mind that I have not confirmed the linux commands, I am using windows 10.

too lazy to make a pull request

Line 418: set JAVA_HOME=path\to\jdkfx-<span class="JFX_VERSION">11</span> Line 424: Since the JavaFX modules are already part of the runtime, now you can run the <a class="samples" href="https://github.com/openjfx/samples/blob/master/HelloFX/CLI/hellofx/HelloFX.java" target="_blank">HelloFX.java</a> Line 425: without the need of adding <kbd>--module-path %PATH_TO_FX% --add-modules javafx.controls</kbd> anymore, like: Line 446: "%JAVA_HOME%\bin\javac" HelloFX.java Line 447: "%JAVA_HOME%\bin\java" HelloFX

The changes for lines 446 and 447 matches the format found at Line 388. It also makes sure you are using jdkfx and not jdk. The original code on those two lines were overly complicated for a simple demonstration of HelloFX example imho. I am new to JavaFX and felt frustration when it didn't work the first time from copy/paste and spent time trying to trouble shoot something I knew nothing about.

I made a batch script as I was bored and to also double check my work.

if exist "%userprofile%\jdkfx-11\." goto dontjlink
set JAVA_HOME=C:\Program Files\AdoptOpenJDK\jdk-11.0.8.10-openj9
set PATH_TO_FX_MODS=C:\Program Files\AdoptOpenJDK\javafx-jmods-11.0.2
"%JAVA_HOME%\bin\jlink" --module-path "%PATH_TO_FX_MODS%" --add-modules java.se,javafx.fxml,javafx.web,javafx.media,javafx.swing --bind-services --output "%userprofile%\jdkfx-11"

:dontjlink
set JAVA_HOME=%userprofile%\jdkfx-11
powershell -c "Invoke-WebRequest -Uri 'https://github.com/openjfx/samples/raw/master/HelloFX/CLI/hellofx/HelloFX.java' -OutFile '.\HelloFX.java'"
"%JAVA_HOME%\bin\javac" HelloFX.java
"%JAVA_HOME%\bin\java" HelloFX
pause

skaviouz avatar Sep 01 '20 05:09 skaviouz