I started a new JavaFX application with the JavaFX project template that IntelliJ gives you that will only display a GUI created with Scene Builder with some line charts, as far as I'm concerned, the code is right and simple, it's just a test project.
Also, I can't visualize the .class file in IntelliJ
The message is:
Error occurred during initialization of boot layer
java.lang.module.FindException: Error reading module: C:\Users\pv3\Desktop\PruebasFX_OracleFXProyectInicio\target\classes
Caused by: java.lang.module.InvalidModuleDescriptorException: GraficasVentPrueba1.class found in top-level directory (unnamed package not allowed in module)
Process finished with exit code 1
My code:
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
public class GraficasVentPrueba1 extends Application {
@Override
public void start(Stage stage) throws IOException{
FXMLLoader launcherGraficas = new FXMLLoader(GraficasVentPrueba1.class.getResource("GraficasVentPrueba1.fxml"));
Scene emergenteGraficas = new Scene(launcherGraficas.load());
stage.setScene(emergenteGraficas);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
It supposed to just open the .fxml. Instead it shows that error message
CodePudding user response:
Java Platform Module System
In your error message, unnamed package not allowed in module is the key here.
Check your module-info.java
file created by the JavaFX project template in IntelliJ. Be sure to edit that file to keep up with changes you make.