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

后端 未结 6 846
庸人自扰
庸人自扰 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:55

    Just to put my two cents in, I had this problem and it was caused by something-or-other in the manifest, I suppose. I resolved it by generating the executable JAR in a different manner:

    Previous developer generated the Runnable JAR from Eclipse (right-click project -> Export... -> Runnable JAR) and this worked fine for everyone. Then I came along and generated the runnable JAR by configuring a Maven plugin ("assembly") in the pom.xml and so a classic Maven build would produce the runnable JAR.

    This worked nicely for me (from cmd and by double-clicking) but not for the end-users (who could still run the tool from cmd, but not by double-clicking the JAR).

    I generated the runnable JAR from Eclipse and now everyone is happy again. Not sure why the maven-generated JAR wasn't ok to run by double-clicking, but I can't be bothered to investigate further now that the job is done. Hope this half-advice helps someone.

提交回复
热议问题