0

I updated my Maven-based JavaFX project from Java 8 to Java 11. Because Java 11 does not include JavaFX anymore, I included the JavaFX Maven plugin in my pom.xml as explained in https://openjfx.io/openjfx-docs/#IDE-Eclipse:

<properties>
    ...
    <javafx.version>11.0.2</javafx.version>
    ...
</properties>

<dependencies>
    ...
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-controls</artifactId>
        <version>${javafx.version}</version>
    </dependency>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-fxml</artifactId>
        <version>${javafx.version}</version>
    </dependency>
</dependencies>
...
<plugin>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-maven-plugin</artifactId>
    <version>0.0.3</version>
    <configuration>
        <mainClass>my.javafx.main.class</mainClass>
    </configuration>
</plugin>

However, when I run it with mvn clean javafx:run as instructed, I get the error below. What can be wrong?

EDIT: please note that the initial messages about module names are warnings. I am not sure they are related to the error.

It seems the crucial error is the exception java.lang.ClassNotFoundException: com.sun.javafx.css.parser.CSSParser.

[INFO] --- javafx-maven-plugin:0.0.3:run (default-cli) @ aic-praise ---
[WARNING] Can't extract module name from protobuf-java-util-shaded-351-0.9.jar: protobuf.java.util.shaded.351: Invalid module name: '351' is not a Java identifier
[WARNING] Can't extract module name from datavec-data-image-1.0.0-beta4.jar: Provider class com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReaderSpi not in module
[WARNING] Can't extract module name from nd4j-native-1.0.0-beta4-android-x86.jar: nd4j.native: Invalid module name: 'native' is not a Java identifier
[WARNING] Can't extract module name from nd4j-native-1.0.0-beta4-linux-x86_64.jar: nd4j.native: Invalid module name: 'native' is not a Java identifier
[WARNING] Can't extract module name from nd4j-native-1.0.0-beta4-android-x86_64.jar: nd4j.native: Invalid module name: 'native' is not a Java identifier
[WARNING] Can't extract module name from nd4j-native-1.0.0-beta4-android-arm.jar: nd4j.native: Invalid module name: 'native' is not a Java identifier
[WARNING] Can't extract module name from nd4j-native-1.0.0-beta4-linux-ppc64le.jar: nd4j.native: Invalid module name: 'native' is not a Java identifier
[WARNING] Can't extract module name from nd4j-native-1.0.0-beta4-linux-armhf.jar: nd4j.native: Invalid module name: 'native' is not a Java identifier
[WARNING] Can't extract module name from nd4j-native-1.0.0-beta4-ios-arm64.jar: nd4j.native: Invalid module name: 'native' is not a Java identifier
[WARNING] Can't extract module name from nd4j-native-platform-1.0.0-beta4.jar: nd4j.native.platform: Invalid module name: 'native' is not a Java identifier
[WARNING] Can't extract module name from nd4j-native-1.0.0-beta4-macosx-x86_64.jar: nd4j.native: Invalid module name: 'native' is not a Java identifier
[WARNING] Can't extract module name from nd4j-native-1.0.0-beta4-android-arm64.jar: nd4j.native: Invalid module name: 'native' is not a Java identifier
[WARNING] Can't extract module name from nd4j-native-api-1.0.0-beta4.jar: nd4j.native.api: Invalid module name: 'native' is not a Java identifier
[WARNING] Can't extract module name from nd4j-native-1.0.0-beta4-windows-x86_64.jar: nd4j.native: Invalid module name: 'native' is not a Java identifier
[WARNING] Can't extract module name from apache-jena-libs-3.6.0.pom: Only outputDirectories and jars are accepted on the path
[WARNING] Can't extract module name from protobuf-java-shaded-351-0.9.jar: protobuf.java.shaded.351: Invalid module name: '351' is not a Java identifier
[WARNING] Can't extract module name from nd4j-native-1.0.0-beta4.jar: nd4j.native: Invalid module name: 'native' is not a Java identifier
[WARNING] Can't extract module name from nd4j-native-1.0.0-beta4-ios-x86_64.jar: nd4j.native: Invalid module name: 'native' is not a Java identifier
[WARNING] Some dependencies encountered issues while attempting to be resolved as modules and will not be included in the classpath; you can change this behavior via the  'includePathExceptionsInClasspath' configuration parameter.
Exception in Application start method
java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: Exception in Application start method
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: javafx.fxml.LoadException: 
/C:/Users/E26638/git/aic-praise/target/classes/com/sri/ai/praise/other/application/praise/app/praiseapp.fxml

    at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2625)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2595)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466)
    at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2435)
    at com.sri.ai.praise.other.application.praise.app.PRAiSE.start(PRAiSE.java:54)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    ... 1 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at com.sun.javafx.reflect.Trampoline.invoke(MethodUtil.java:76)
    at jdk.internal.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at javafx.base/com.sun.javafx.reflect.MethodUtil.invoke(MethodUtil.java:273)
    at javafx.fxml/com.sun.javafx.fxml.MethodHelper.invoke(MethodHelper.java:83)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2591)
    ... 12 more
Caused by: java.lang.NoClassDefFoundError: com/sun/javafx/css/parser/CSSParser
    at de.jensd.fx.glyphs.GlyphIcon.<clinit>(GlyphIcon.java:218)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at java.base/java.lang.Class.newInstance(Class.java:584)
    at de.jensd.fx.glyphs.GlyphsBuilder.<init>(GlyphsBuilder.java:21)
    at de.jensd.fx.glyphs.GlyphsBuilder.create(GlyphsBuilder.java:28)
    at com.sri.ai.praise.other.application.praise.app.FXUtil.setButtonStackedIcons(FXUtil.java:100)
    at com.sri.ai.praise.other.application.praise.app.PRAiSEController.initialize(PRAiSEController.java:253)
    ... 23 more
Caused by: java.lang.ClassNotFoundException: com.sun.javafx.css.parser.CSSParser
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 33 more
Exception running application com.sri.ai.praise.other.application.praise.app.PRAiSE
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
    at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
    at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
    at org.openjfx.JavaFXBaseMojo.executeCommandLine(JavaFXBaseMojo.java:491)
    at org.openjfx.JavaFXBaseMojo.executeCommandLine(JavaFXBaseMojo.java:453)
    at org.openjfx.JavaFXRunMojo.execute(JavaFXRunMojo.java:97)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
    at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
    at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
    at org.openjfx.JavaFXBaseMojo.executeCommandLine(JavaFXBaseMojo.java:491)
    at org.openjfx.JavaFXBaseMojo.executeCommandLine(JavaFXBaseMojo.java:453)
    at org.openjfx.JavaFXRunMojo.execute(JavaFXRunMojo.java:97)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
user118967
  • 4,895
  • 5
  • 33
  • 54
  • Thanks, but I don't think so. The messages about module names are warnings. It seems the real error is `java.lang.ClassNotFoundException: com.sun.javafx.css.parser.CSSParser`. – user118967 Apr 13 '20 at 03:45
  • 1
    Does this answwer your question? [javaFX program not working after changing the scene builder and jdk](https://stackoverflow.com/questions/51670146/javafx-program-not-working-after-changing-the-scene-builder-and-jdk/51670666) – Abra Apr 13 '20 at 04:00

0 Answers0