.jar files open and close immediately

Hi,

I am trying to download a .jar file, however, when I try to open it, it opens very quickly and closes immediately.  I am opening it with the latest version of Java so I'm not sure what the problem could be. I am doing this on a new laptop if that helps. Thank you!

Hello RYAN71098,

1. Reinstall or update Java Runtime Environment

If you can’t run jar files on your Windows 10 PC, you might need to reinstall Java Runtime Environment. To do that, follow these steps:

Press Windows Key + I to open the Settings app.
When the Settings app opens, go to the System section. Now, choose Apps & features from the left pane.

Locate Java from the list and choose the Uninstall option.

After doing that, navigate to Java’s website and download the latest version of the software. Once installed, check if the problem is resolved.

Java will also automatically check for updates, and if updates are available you’ll get a notification. To update Java, simply click the notification and choose the Update option. Now follow the instructions to complete the update.

2. Set file association

Jar files can’t run on your PC if you don’t have the proper associations. For example, jar files can be associated to run with other applications or they could lack file association completely.

If the situation is the latter one, you won’t be able to run jar files on your PC. However, you can easily fix this problem by changing the file association for jar files. To do that, follow these steps:

Open the Settings app. Navigate to the System > Default apps.

Scroll all the way down and select Choose default apps by file type.

Locate the .jar file type and choose a default application.

3. Create a .bat file

According to users, you can run jar files on Windows 10 by using this simple workaround. This solution requires you to create a .bat file and use it every time you want to run a specific jar file. The process is rather simple and you can do it by following these steps:

Locate your jar file. In the same folder, create a new Notepad file. To do that, right-click empty space in the directory and choose New > Text Document.

When Notepad opens, enter java -jar filename.jar. Be sure to replace filename.jar with the actual name of the file.

Navigate to the File > Save as.

Set Save as type to All files. Now, enter the desired name for the file. Keep in mind that you need to have .bat as an extension or else the solution won’t work. Save the file in the same location where your jar file is located.

After doing that, locate your .bat file and double-click it. Your jar file will now open. Keep in mind that you need to repeat this process for every jar file that you want to run on your PC. In addition, be sure to save the .bat file in the same location as your jar file.

Hope it helps, have a good day

134 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Ryan,

If your file associations are not set correctly, that may be the cause, and it can be hard to set jar file associations . ..

Click the link below to download a tiny exe, that does not need to be installed, run that to restore jar file associations on your PC

https://johann.loefflmann.net/en/software/jarfi...



________________________________________________________
Standard Disclaimer: This is a non-Microsoft website. The page appears to be providing accurate, safe information. Watch out for ads on the site that may advertise products frequently classified as a PUP (Potentially Unwanted Products). Thoroughly research any product advertised on the site before you decide to download and install it.
___________________________________________________________________

Power to the Developer!

MSI GV72 - 17.3", i7-8750H (Hex Core), 32GB DDR4, 4GB GeForce GTX 1050 Ti, 256GB NVMe M2, 2TB HDD

155 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated May 15, 2024 Views 80,185 Applies to: