How to open/run .jar file (double-click not working)?

前端 未结 15 1140
陌清茗
陌清茗 2020-12-15 17:26

I can\'t open or run my .jar file.

I just installed java, but I tried to open the .jar with other programs first, so the double-click defaults to something else and

15条回答
  •  爱一瞬间的悲伤
    2020-12-15 17:55

    An easy way to execute .jar files is to create a batch file.

    Let's say you placed your jar file on your Desktop;

    @echo OFF
    java -jar C:\Users\YourName\Desktop\myjar.jar
    

    Copy this code to a .txt file, modify "YourName" and save as "myjar.bat". Then whenever you double click, the jar file will be executed. Hope this helps.

提交回复
热议问题