Home > front end >  Cannot open .jar files with java installed (windows 11)
Cannot open .jar files with java installed (windows 11)

Time:09-22

Environment: Windows 11 Problem: cannot open .jar file(the MARS assembly language simulator)

Hello, I am currently trying to install the MARS assembly language simulator. It is a .jar file so I downloaded java to open it. However, I still can't open the file even with java downloaded. I checked if java was installed using my cmd: Command prompt showing java successfully installed

I tried double-clicking it did not work. So I right-clicked it to open with other apps. But I did not see java in the given options. Cannot find the java option to open the file

Thank you so much for helping!

CodePudding user response:

Use your prompt CD into the directory with the jar then execute java -jar Mars.jar ...any more troubles , open file properties tab with right click on the jar and check permissions to execute the file.

CodePudding user response:

Installing Java usually means installing a JVM, which is a Java Virtual Machine. You won't be able to launch files from a Windows context menu like this, because "Java" is not a program that opens files.

Instead you need to:

  • Either a terminal and call javaw.exe with the parameters -jar and your .jar-file. E.g.:
C:\your\java\binaries\javaw.exe -jar -SomeJarFile.jar
  • Or add the Java installation to your environment variables, then you can call javaw.exe without providing some specific path
  • Related