Cannot build Java 8 Project with system Java version being latest [RESOLVED]
已回答
Hey!
I'm having an issue trying to build my Java 8 project which uses JavaFX. I did not have this problem originally when I had Java 8 installed on my system, but for another project I need to use the latest version of Java, so I am now using Java version 22.0.1. Ever since updating, I can no longer properly build my Java 8 project… I do not want to change the Java version on my computer, but would like my Java 8 project within IntelliJ to be built with Java 8 and ran with it as well. I have provided screenshots below of my current settings trying to accomplish this. Any help is appreciated. Thanks!



When I try to build the project, I get the following error:

请先登录再写评论。
For some interesting reason, this issue only happens when making it a JavaFX artifact… The artifact will run fine as a JAR file from modules with dependencies. When using a JavaFX artifact, you'll encounter the above issues no matter all the settings you turn to Java 8. Hoping this can be fixed in a future release or at least further explained by the JetBrains team? Thanks!
Hello,
It seems you are facing the problem https://youtrack.jetbrains.com/issue/IDEA-351703/Error-building-JavaFX-artifact-in-IntelliJ-IDEA
According to our developer's advice:
The Maven/Gradle is the suggested way to dev a JavaFX project.
You may use these two maven goals to package the project:
jar -> a jar file created
jlink -> a minimal distribution app.zip is created with JavaFx bundled, which can be run be unzipping and exectute the bin/app script.
Please check if the above steps help.