JavaFX - JDK17: building artifacts

已回答

In the last 3 days, I've been trying to build the artifacts of a JavaFX application, without success. Below a few specs of the system I am working with:

- IntelliJ 2021.3.1 Build #IC-213.6461.79 (CE)

- Fedora 35

- JDK 17

After some research, it is my understanding that at present, building JavaFX artifacts is problematic at best. I have looked for and tried a number of solutions but none worked and most are probably outdated. Below two issues I stumbled upon when trying to build the artifacts:

1) Going through File -> Project Structure -> Artifacts -> JavaFX Applications simply does not work. This due to the "Can't build artifact - fx:deploy is not available in this JDK" problem.

2) https://stackoverflow.com/questions/54806788/javafx-cant-build-artifact-fxdeploy-is-not-available-in-this-jdk?newreg=ec339fb8876f499eb0abf52934728151

This is the closest thing I saw to a solution regarding point 1. Unfortunately it does not work for me, and this leads to issue no.2.

The response to that post basically suggests to go through File -> Project Structure -> Artifacts -> "+" -> JAR -> from module with dependancies checking copy to the output directory and link via Manifest.

I follow it but once I get the artifacts, when running java -jar jarfile all I get is a

Error: Invalid or corrupt jarfile

Please note that I followed everything that is recommended in that post. I am clueless on what to do exactly here, any help on this would be really appreciated.

Regards

Stefano C.

评论操作 固定链接

Hi Stefano,

Try moving the entire META-INF directory with your MANIFEST.MF file to the resources directory, and then re-building the artifact.

1
评论操作 固定链接

Arina mam, thank you so much.

0
评论操作 固定链接

META-INF directory and MANIFEST.MF file are already in the resources directory and I have the same problem.

https://stackoverflow.com/questions/54806788/javafx-cant-build-artifact-fxdeploy-is-not-available-in-this-jdk?newreg=ec339fb8876f499eb0abf52934728151

When I try this and run my executable jar from the command line it gives an error that:

Error: JavaFX runtime components are missing, and are required to run this application

 

Any help ??

0

请先登录再写评论。