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

"Getting Started with JavaFX > Run HelloWorld using Maven" doesn't work with javafx 17

Open DieterMai opened this issue 4 years ago • 5 comments

When executing the steps described at https://openjfx.io/openjfx-docs/#maven the hello world program fails to compile. The issue only occurs with JavaFX 17 but not with 16 or earlier. see log file

maven.log

DieterMai avatar Nov 03 '21 13:11 DieterMai

my Environment:

$ mvn --version
Apache Maven 3.8.3 (ff8e977a158738155dc465c6a97ffaf31982d739)
Maven home: C:\Users\Dieter\devel\tools\maven\apache-maven-3.8.3
Java version: 17, vendor: Oracle Corporation, runtime: C:\Users\Dieter\devel\tools\jdk\OracleOpenJDK\jdk-17
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Dieter@Dieter-PC-2015 MINGW64 ~/devel/tutorials/jfxMavenRunExample/sample
$ java --version
openjdk 17 2021-09-14
OpenJDK Runtime Environment (build 17+35-2724)
OpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)

DieterMai avatar Nov 03 '21 13:11 DieterMai

When executing the steps described at https://openjfx.io/openjfx-docs/#maven the hello world program fails to compile. The issue only occurs with JavaFX 17 but not with 16 or earlier. see log file

maven.log

I have the same issue. By looking at the POM of javafx-controls version 17, I guess it's the POM issue, so I change the version to '17.0.2-ea+1', and it succeeded!

Conclusion, we can use the newest version of javafx 17 such as '17.0.2-ea+1' to run the sample.

yangbo avatar Dec 04 '21 08:12 yangbo

Changing the JavaFX version to 17.0.1 lets the program in the sample directory run, at least on my Mac.

  • The <artifactId> of HelloFX doesn't appear in any of the code for the sample application. It is sample on my system.
  • Changing the version of the plugin from 0.0.3 as produced by the archetype to any version 0.0.5 or later (including 0.0.8 as shown in the article) produces a warning, but the program will still run. Can't find any explanation for what the warning means or how to fix it.
  • You don't need to add the JavaFX dependencies as mentioned in the article. They are already present in the POM produced by the archetype.
  • The <mainClass> shown in the article is wrong. It is org.openjfx.App on my system.
  • There is no HelloFX.java file to run.
java --version
openjdk 17.0.1 2021-10-19
OpenJDK Runtime Environment Homebrew (build 17.0.1+1)
OpenJDK 64-Bit Server VM Homebrew (build 17.0.1+1, mixed mode, sharing)
mvn --version
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: /usr/local/Cellar/maven/3.8.4/libexec
Java version: 17.0.1, vendor: Homebrew, runtime: /usr/local/Cellar/openjdk/17.0.1_1/libexec/openjdk.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "12.1", arch: "x86_64", family: "Mac"

clartaq avatar Dec 26 '21 22:12 clartaq

Good find, thanks.

I found that any version of 17.0.x besides 17 works. I tested it with 17.0.1 and the latest 17.0.7.

If anyone can tell us why 17 has a problem I am curious to know and learn. Thanks.

authentictech avatar May 31 '23 19:05 authentictech

See JDK-8273754. It affected JavaFX 17, and was fixed in 17.0.1 (and in a 17.0.0.1 patch).

kevinrushforth avatar May 31 '23 20:05 kevinrushforth