0

I'm setting up a JavaFX project with Maven for the first time, and followed the steps exactly as on openjfx's website. All I have done so far is replace the default FXML files with my own, yet I keep getting this error.

What's strange, however, is that my FXML files still load. My project runs, but I still get the warning. I've never seen this error before on my last project, which didn't use Maven.

Here is my relevant code:

public class App extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage stage) throws Exception{

        Parent root =
                FXMLLoader.load(getClass().getResource(
                        "proj2.fxml"));
        stage.setTitle("proj2");
        stage.setScene(new Scene(root, 500, 500));
        stage.show();
    }
}

My module-info folder:

module org.proj2 {
    requires javafx.controls;
    requires javafx.fxml;


    opens org.proj2 to javafx.fxml;
    exports org.proj2;
}

And everything else was from a standard, modular Maven project setup, or at least what was described on openjfx's site. And my FXML files are in the resources folder as given in the setup.

Should I just ignore the warning? How can I get rid of it? I'm aware I don't have much information to go off of so I'll include any other files in my post if necessary.

Prentice
  • 31
  • 1
  • 4
  • With regards to why the warning occurs, see https://stackoverflow.com/questions/67854139/javafx-warning-unsupported-javafx-configuration-classes-were-loaded-from-unna. It seems like Maven is putting JavaFX on the class-path. Though I'm not sure how to fix that in Maven. – Slaw Jul 21 '21 at 21:45
  • Thanks for the link. So far it doesn't seem to be causing any errors, it's just a warning and my FXML still loads fine. And like the link says, using JavaFX 15 produces no warning (although my FXML uses JavaFX 16 API so I prefer using 16). Would you recommend just ignoring the warning and continuing, or to stop using Maven in favor of Gradle or perhaps neither? It's a fairly simple personal project I'm doing so in any case Gradle/Maven wouldn't necessarily be that helpful (at least from what I read about the two). – Prentice Jul 21 '21 at 21:57
  • Personally, I'd recommend you stick with Maven and ignore the warning if it is not causing any noticeable issue. That is just a personal recommendation. – jewelsea Jul 21 '21 at 23:45
  • For now I second @jewelsea and recommend you ignore the warning and continue using Maven. You're just learning how to use both and should put most of your effort into that. Once you better understand Java, JavaFX, Maven, and Java modules maybe then you can revisit fixing the warning. Besides, like I mention in my answer to the linked Q&A, nothing currently seems to break when that warning is emitted. – Slaw Jul 22 '21 at 05:31
  • I do find the warning strange in your case though. As far as I can tell, Maven should automatically put dependencies with `module-info` descriptors on the module path. And your own code has a `module-info` descriptor so Maven should really be putting everything on the module path. Are you using the latest version of Maven? – Slaw Jul 22 '21 at 05:37
  • I should be using the latest version, double checked and all. I just included some of the modules in VM options like I did with my last project and it seemed to make the warning go away. – Prentice Jul 22 '21 at 19:43

0 Answers0