簡體   English   中英

在JVM上設置默認參數

[英]Setting default arguments on JVM

我正在為組裝系統開發javafx應用程序。 (WIN 7 EMB,JAVA 8)

該系統是觸摸式(無鍵盤),但默認情況下未設置JVM

如何在JVM上一次確定地設置此參數?

-Dcom.sun.javafx.isEmbedded=true
-Dcom.sun.javafx.touch=true
-Dcom.sun.javafx.virtualKeyboard=javafx

感謝幫助!

在調用Application.launch(...)之前,JavaFX不會初始化。 您應該嘗試在例如main(String[] args)方法中設置系統屬性:

public static void main(String[] args) {
    System.setProperty("com.sun.javafx.isEmbedded", "true");
    System.setProperty("com.sun.javafx.touch", "true");
    System.setProperty("com.sun.javafx.virtualKeyboard", "true");
    launch(args); // launch JavaFX
}

最后,我找到了一個類似的解決方案,將我的主程序包裝到另一個設置了jvm prop的程序中,然后再啟動原始主程序。

 package launcher;

import application.Main;

public class myLauncher {

    public static void main(String[] args) {


        Main.main(null);

    }

}

這是主要的

public static void main(String[] args) {
            System.setProperty("com.sun.javafx.isEmbedded", "true");
            System.setProperty("com.sun.javafx.touch", "true");
            System.setProperty("com.sun.javafx.virtualKeyboard", "javafx");
            launch(args);
            }

(必須在罐子導出時標記->“提取生成的罐子中的所需庫”以進行工作!)

抱歉,我對此解決方案沒有明確的解釋!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM