问题
I wrote JavaFX application that can be execute in two modes. With GUI and without.
If command line command has two parameters then cli selected, else gui:
public static void main(String[] args) {
if (args != null && args.length > 0 && args[0].equals("cli")) {
String pathToProperties = args[1];
Cli cli = new Cli(pathToProperties);
cli.loadPropertiesAndGenerateApk();
} else {
Application.launch(args);
}
}
In Intellij IDEA when I click Run
button everything works fine.
But when I build artifacts (.jar file) and try to run in cli mode -- GUI opens:
java -jar JavaFXApp.jar cli /path/toconfig.properties
Does anybody know why?
Update: I added System.out.println(args[0])
as @fdsa asked. And see that program launch in terminal no message:
https://yadi.sk/i/uwGT4EpVkDCea
来源:https://stackoverflow.com/questions/33503220/javafx-program-doesnt-run-in-nogui-command-line-mode