0

Running a .jar file in a command line works fine, but i am not able to run any .jar file by double clicking on my Windows 7 (64). It seems nothing happens after the double click

I set the path JRE path in my regedit HKEY_CLASSES_ROOT with JRE path but still its not running.

Any Solutions for this?

  • Yes but i need more clarification why this is not working normally? – Ravisankar May 12 '20 at 08:40
  • 1
    If you read the answers given in that question that @AniketSahrawat linked, you'll see that there are suggestions on how to set up a file type correctly so that it always works with a double click without the need for a batch file (And explains why it is needed). There's a whole host of explainations and suggestions on how to get it to work, even an app that will set it up for you. – Jamie Reid May 12 '20 at 09:05

1 Answers1

0

If you have a .jar file called Example.jar, follow these steps:

  1. Open a notepad.exe
  2. Write : java -jar Example.jar
  3. Save it with the extension .bat
  4. Copy it to the directory which has the .jar file
  5. Double click the .bat file which will run your .jar file

See this article for a more detailed explanation of the above steps.

Oozeerally
  • 842
  • 12
  • 24
  • Thank you the answer it is working with windows. Do we have any other option make common for all operating systems? – Ravisankar May 12 '20 at 08:43
  • You're welcome, if the answer is working please accept/upvote it :) For unix and linux you can run a shell script which is the batch file equivalent on unix based systems, note that the shell script is also platform specific, but should work on Unix and Linux based systems - please see this answer for how to make a .sh script for running a .jar (https://stackoverflow.com/questions/29847709/run-a-jar-file-using-sh-file-in-unix) – Oozeerally May 12 '20 at 08:51