0

I write basic java programs for fun, and unfortunately I cannot run their jar files with double clicking. However, I can open jar files through terminal with no issue. could you please explain to me the issue and how to fix it? I reordered my screen and uploaded it on YouTube if you want to see what happens when I click on a jar file:

https://www.youtube.com/watch?v=Pyh5k2w_o1s

Thanks for all your suggestions.

  • I think this is more about computer *use* rather than about programming (the fact that you wrote the program is just incidental), but then again I found [this other question](https://stackoverflow.com/questions/63320019/macos-launch-jar-file-by-double-clicking) in case someone thinks this is a duplicate rather than OT. – Federico klez Culloca Jun 30 '22 at 11:27

2 Answers2

0

Try this solution:

https://stackoverflow.com/a/43881858/13257777

by script let use:

java -jar path_to_Lab15.jar
mcieciel
  • 59
  • 3
-2

Downloading a Java Runtime Environment can do the trick.

For future projects you may want to checkout Launch4j. It is a tool to convert your runnable .jar file to an .exe.

TaiiKii
  • 1
  • 4
  • Thanks for your response. I am a Mac user, is there any similar solution for Mac? – user11813719 Jun 30 '22 at 12:28
  • btw when I type Java -version in terminal, I get : java -version java version "1.8.0_331" Java(TM) SE Runtime Environment (build 1.8.0_331-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.331-b09, mixed mode) So I think I have JRE installed. Am I correct? – user11813719 Jun 30 '22 at 12:34
  • yes you are correct. You got one of the newest JRE installed. Unfortunately I don't know about a similar solution for Mac. I'm sorry. – TaiiKii Jun 30 '22 at 14:16