Reputation: 3390
I'm trying to reference a set of APIs from my JavaFX project:
import jakarta.ws.rs.client.Client;
import jakarta.ws.rs.client.ClientBuilder;
import jakarta.ws.rs.client.WebTarget;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.Response;
These APIs are available in this dependency:
<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<version>3.0.0</version>
</dependency>
Therefore, I have added the jakarta.ws.rs-api in my project's module-info.java :
module com.example.javafx {
requires javafx.controls;
requires javafx.fxml;
requires org.controlsfx.controls;
//External API
requires jakarta.ws.rs-api;
opens com.example.javafx to javafx.fxml;
exports com.example.javafx;
}
However, it seems incorrect: "Module directive expected" for "jakarta.ws.rs-api". Should I use a different format to specify the external dependency? Thanks
Upvotes: 0
Views: 398
Reputation: 311
You must use the module name after requires
.
The dash is not a allowed character for module names, just like for package name.
You can obtain the name of a module bundled in a jar file with:
jar --describe-module --file jakarta.ws.rs-api-3.1.0.jar
which gives jakarta.ws.rs
Upvotes: 2