简体   繁体   中英

Adding VM flag to pom.xml file in JavaFX Maven project

I am trying to run my JavaFX application via Maven.

I use Archlinux + Wayland + Java 11 (JDK + JFX).

I have been getting this error message:

(java:26713): Gdk-CRITICAL **: 11:35:39.602: gdk_x11_display_set_window_scale: assertion 'GDK_IS_X11_DISPLAY (display)' failed

I should use -Djdk.gtk.version=2 VM flag according to this GitHub issue:

https://github.com/bisq-network/bisq/issues/2279#issuecomment-469010726

How can I add that VM flag to my pom.xml file?

I've already tried to insert this code, but the syntax must be wrong.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.8.0</version>
    <configuration>
        <release>11</release>
        <compilerArgs>
            <arg>-Djdk.gtk.version=2</arg>
        </compilerArgs>
    </configuration>
</plugin>

Thanks for any help!

From maven pass-compiler-arguments documentation you are passing the vm argument jdk.gtk.version=2 to the javac compiler, while instead from your request you should pass it to your java VM. From maven configure documentation to handle this issue you can configure Apache Maven in multiple ways, for example using MAVEN_OPTS and add there your VM settings, you can check the link for additional ways to do it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM