Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal Exception when executing javafx:run #21

Closed
justinhschaaf opened this issue Jun 3, 2019 · 6 comments
Closed

Fatal Exception when executing javafx:run #21

justinhschaaf opened this issue Jun 3, 2019 · 6 comments

Comments

@justinhschaaf
Copy link

Hello! I've been attempting to add the JavaFX plugin and dependencies to a project I've been working on; however, whenever I run my program, I am faced with a fatal error that prevents the JVM from starting:

Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Unrecognized option: --module-path

The full log is available here. I'm using Java 11.0.2 and javafx-maven-plugin 0.0.2.

@tiainen
Copy link
Contributor

tiainen commented Jun 3, 2019

The error message indicates that the JVM being used is still Java 8, because the --module-path option has been introduced with Java 9. Make sure that you configure your maven project to build with Java 11 or later.

@justinhschaaf
Copy link
Author

It does appear that maven is using Java 8 rather than Java 11; however, my IDE's settings show that maven is using Java 11.

@jperedadnr
Copy link
Collaborator

jperedadnr commented Jun 3, 2019

As explained here: https://openjfx.io/openjfx-docs/#IDE-Intellij, Maven sections, if you run from your IDE, the plugin might pick the Java_Home it is using (for instance IntelliJ runs on JDK 1.8), so you can add this to the plugin:

<configuration>
    <executable>/path/to/jdk-11/bin/java</executable>
</configuration>

Anyway, this shouldn't be necessary, if the project has SDK and language level set to 11, the platform sdk is 11, or if you run from a terminal with Java_Home set to 11.

If none of that works, please detail your IDE and OS versions.

@justinhschaaf
Copy link
Author

Adding the configuration worked for me. Thank you very much!

@mkpaz
Copy link

mkpaz commented Sep 10, 2019

For those who don't want to spoil pom.xml with workstation related paths. There are another option. If you're defining current JVM version via JAVA_HOME env variable, you can just overwrite it in IDE settings.

изображение

изображение

P.S. It's rather confusing that OpenJFX ignores IDE SDK settings and uses JRE from path env variable instead.

@jperedadnr
Copy link
Collaborator

@mkpaz If you think this can be improved, please file a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants