1

I have managed to build a GraalVM / JavaFX build but when I run it I get the following error:

$ ./app
Jul 15, 2023 9:49:59 AM com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @21325036'
java.lang.ClassNotFoundException: com.sun.javafx.tk.quantum.QuantumToolkit
    at java.base@17.0.6/java.lang.Class.forName(DynamicHub.java:1132)
    at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:253)
    at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:290)
...

It states the guilty module is 'unnamed module @21325036', which is pretty useless to me. How do I map this id to the module's actual name so I can find out what is wrong?

Graham Seed
  • 742
  • 3
  • 10
  • 24
  • You probably need javafx.graphics.jmod. How did you build it? – g00se Jul 15 '23 at 09:35
  • 1
    There is only one unnamed module, and that comprises all classes and libraries on the classpath. Only libraries on the modulepath become a (named) module. In other words, you don't need to find out its name, you need to correctly configure the modulepath. – Mark Rotteveel Jul 15 '23 at 10:05
  • I built it using GraalVM, starting from a Maven pom.xml that works without GraalVM. I then added the block described here [https://graalvm.github.io/native-build-tools/latest/maven-plugin.html]. I assumed it would load the required JavaFX modules but it's clearly not including them and I have no way of pointing it to the modules by using --module-path and add-modules as I could do pre-GraalVM. – Graham Seed Jul 15 '23 at 12:26
  • "you need to correctly configure the modulepath" --> and how do I do that with a JavaFX v20 project? After adding the GraalVM block I looked at the configuration options but don't see any for specifying the module path. – Graham Seed Jul 15 '23 at 12:27
  • Do you know of a good example/tutorial that details how a module JavaFX project is built using jmods and GraalVM? – Graham Seed Jul 15 '23 at 12:30
  • 1
    You know you can build an executable (and even an installer) with just the jdk now? – g00se Jul 15 '23 at 13:00
  • "You know you can build an executable (and even an installer) with just the jdk now? " --> point me to a detailed webpage that shows how, otherwise such answers are a waste of time – Graham Seed Jul 15 '23 at 19:12
  • g00se is most likely referring to the [jpackage](https://docs.oracle.com/en/java/javase/20/jpackage/packaging-overview.html#GUID-C1027043-587D-418D-8188-EF8F44A4C06A) tool. Though note that tool does not perform ahead-of-time compilation like GraalVM's native image does. – Slaw Jul 15 '23 at 19:14
  • @GrahamSeed Related [How to create a standalone .exe in Java (that runs without an installer and a JRE)](https://stackoverflow.com/questions/69811401/how-to-create-a-standalone-exe-in-java-that-runs-without-an-installer-and-a-jr/69824145#69824145). That example uses the JDK + Warp to build a native executable, and has some discussion of alternate distribution options. It is not an answer to your question or related to it, but is related to your request for information in comments on building executables. – jewelsea Jul 15 '23 at 20:40
  • *It is not an answer to your question or related to it, but is related to your request for information in comments on building executables* Yes, indeed. Let's just hope we're not "wasting his time" – g00se Jul 15 '23 at 22:09

0 Answers0