javafx-maven-plugin
javafx-maven-plugin copied to clipboard
System.getProperty(“awt.toolkit”) is null when using javafx:run
here is code:
public class Test extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
System.out.println("AWT_TOOLKIT class name:" + System.getProperty("awt.toolkit"));
System.out.println("user.timezone:" + System.getProperty("user.timezone"));
primaryStage.show();
}
}
when I run application in intellj idea directly, it will work well, print:
AWT_TOOLKIT class name:sun.awt.windows.WToolkit
user.timezone:Asia/Shanghai
but when I use javafx:run, it will print:
AWT_TOOLKIT class name:null
user.timezone:null
and I create runtime-image use jlink, and run launcher.bat, it will print:
AWT_TOOLKIT class name:null
user.timezone:null
how to do?
Can you confirm if the project in both IntelliJ IDEA and Maven are running on the same JDK?
An easy way to do this would be to add:
System.out.println(System.getProperty("java.version"));
@abhinayagarwal Yes. they both use jdk 14.