Why does my JAR file execute at CMD, but not on double-click?

后端 未结 6 855
庸人自扰
庸人自扰 2020-12-03 03:06

So I\'ve been writing a simple 3D GUI application that I intended for users to use simply by double-clicking on the JAR file. I got it working perfectly before putting it in

6条回答
  •  星月不相逢
    2020-12-03 03:59

    The JAR is executable from CMD. That means the JAR itself is formed correctly. Good.

    The only reason to fail now is that double-click produces not a right command. Expected command, as you correctly said, is

    java -jar Modeler.jar
    

    But when you associate javaw.exe with a JAR extension, I suspect it executes

    javaw Modeler.jar
    

    It is easy to check: make a javajar.cmd file, containing the following

    javaw -jar %*
    

    and associate it with JAR. If you app starts OK, I'm right. Otherwise, sorry.

提交回复
热议问题