简体   繁体   中英

Cannot open .jar files with java installed (windows 11)

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!

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.

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. Eg:
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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM