I'm using OpenJDK 11
, IntelijIDEA 2019.2
and javafx-sdk-11.0.2
.
When I wrote JavaFX project, I tried to add external runnable jar from maven project, but IntelijIDEA didn't see classes for this jar.
What I've done:
I added as external library own jar.
In the project tree I found it:
But I couldn't create class objects and use methods that contains this jar:
Why it happens?
If it's modular project
The reason was the use of the file module-info.java
. As we know, JavaFX 11 is not part of the JDK anymore. So, we need to add this special file at the root of our packages w/ lines like:
module modulename {
requires javafx.fxml;
requires javafx.controls;
opens package;
}
From this moment, most likely you won't find classes until you add separately your jar in this code like:
requires name_of_jar;
Only after adding this, you can use your classes/methods from external libs.
If it's non-modular project
As mentioned by mipa , you can follow these instructions as alternative way.
Related links:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.