How To Open JAR File.Have you downloaded a jar program from the Internet and can’t open it? Trying to double-click on its icon, you are asked which software you intend to open it with, or do you see a window that disappears quickly? Don’t despair, the solution is simpler than you think.
In fact, in order to correctly manage files of this type, the most recent version of the Java virtual machine must be installed on the computer, using specific software called JRE or JDK; in some cases, it is necessary to carry out some additional operations to ensure that everything goes smoothly.
I know, said that it seems like a very difficult thing but, I assure you, you are very wrong! Try to put into practice the suggestions that I am about to give you and you will see that, in a short time, you will understand how to open jar files in the easiest and fastest way possible. But now come on, don’t waste any more precious time, roll up your sleeves and start focusing on the information you find below. Enjoy the reading!
Index
- Preliminary information
- How to open a jar file on Windows 10
- How to open jar files on Mac
- How to run a JAR file: Linux
- How to open JAR files on Android, iOS and iPadOS
Preliminary information.
Before going ahead and explaining, in practice, how to open jar files , let me give you some more information about the aforementioned category of elements. In detail, packages of this type contain all the files necessary to be run from any compatible platform, provided that the JRE software or the JDK environment is installed on the latter .
In detail, JRE (or Java Runtime Environment ) is a set of tools that contains everything necessary for the creation of Java virtual machines and, of course, for the execution of the various programs written in this programming language.
The JDK environment (or Java Development Kit ) adds a series of files, libraries and components to the JRE tools that allow you to build programs written in Java from scratch. Both JRE and JDK are licensed by Oracle and can be downloaded for Windows, macOS and Linux for free.
If proceeding with the installation of the JRE or the JDK is only your choice: if you only intend to run .jar files (or other types of software written in Java), the first solution is just fine; if instead you want to enter the world of Java programming and write some programs yourself, you will have to opt for the installation of JDK.
In addition to the versions of Java software licensed by Oracle, there is OpenJDK : if you have never heard of it, it is an open source implementation of the Java platform (both JDK and JRE), maintained and continuously updated by a community of independent developers.
Except in rare exceptional cases, as regards the opening and management of jar files, it is possible to use both the software provided by Oracle and the one made available by the OpenJDK community; for simplicity, I will explain how to install Oracle Java / JDK on Windows and macOS, while for Linux I will show you how to download OpenJDK packages (available almost always in the repositories of the various distributions).
How to open a jar file on Windows 10.
To get started, let’s see how to open a jar file on Windows 10 after installing JRE or JDK. Please note that the same procedure can also be applied to all other editions of the Microsoft operating system, for example Windows 11 , whether they are more or less recent.
Install JRE.
To install JRE on Windows , connected to the Java software home page , click on the Free Java Download button and, when you reach the next page, click on the Accept button and start the free download .
Once the download of the Java environment installation file is complete, open it and click on the Yes , Install , OK and Close buttons to complete the procedure. If obsolete versions of Java are found on the disk, you will be asked to remove them: when this happens, perform the required operation by clicking on the Uninstall and Next buttons .
Install JDK.
If, on the other hand, you intend to install Java Development Kit ( JDK ), connected to this website , locate the Java SE Development Kit section and click on the Windows tab , located a little further down.
Now, click on the download link for the x64 installer entry and wait for the download of the program’s installation package to complete. Download button jdk- [xx] -windows-x64_bin.exe . If you are running 32-bit Windows , you need to download JDK version 8, available on this website .
When the download is complete, open the file you just obtained, click on the Next button twice in a row and complete the setup by pressing the Close button .
Open a file.
Now, before running any .jar file, I advise you to set the Windows environment variables , in order to be absolutely sure not to run into problems due to the apparent unavailability of the Java executable file. This operation only needs to be done once.
To start, right-click on the Windows Start button , select the System item from the context menu that appears on the screen and press the Advanced system settings item , located at the bottom of the window that appears on the desktop.
On the older operating system editions of Windows 10, you must instead right-click on the Computer / This PC icon , select the Properties item from the context menu that appears and then click on the Advanced system settings item , attached to the sidebar of the window that appears later.
Once this is done, click on the Environment Variables … button, click on the New … button below the System Variables box and assign the following values to the variable.
- Variable name:JAVA_HOME
- Variable value: the path where you installed the JRE or JDK (e.g. C:\Program Files\Java\jdk-17.0.1). If you do not know it, click on the Browse directory button , go to the path This PC \ Local disk (C) \ Program Files \ Java , select the folder relating to the version of JRE / JDK in your possession and press the OK button , in order to select it .
Once this is done, click on the OK button to return to the previous screen and then double-click on the Path item already available in the System Variables list and add the text to the end of the Variable Value field , ;%JAVA_HOME%\binleaving everything else unchanged. Finally, restart Windows .
At this point, you are ready to run any file with the .jar extension: usually, it is sufficient to double-click on the icon of the file in question, to start it and view its contents. Alternatively, you can achieve the same result using Windows PowerShell / Windows Terminal or Command Prompt .
So, open the folder that contains the file of your interest and, by pressing and holding the Shift key on the keyboard, right-click on an empty spot on the keyboard and select the item Open PowerShell / Terminal window here or Open Command Prompt here . Finally, issue the command java -jar nomeFile.jarand enter , to start the corresponding application.
How to open jar files on Mac.
Now let’s see how to install the JRE and JDK virtual environments on Mac and how to run a file with the .jar extension.
Install JRE.
To install the Java Runtime Environment on macOS, connected to this website , click on the Free Java Download button and, when you reach the next page, click on the Accept button and start the free download , in order to obtain the package installation for the Java environment.
When the download is complete, open the .dmg file obtained, double-click on the installation program contained within it (eg Java X update Y ) and, after clicking on the Open button , press the Install button and complete the installation of the software by entering, when prompted, the password of the Mac and pressing the Enter key on the keyboard.
Finally, choose whether to move the installation package of the program to the Trash or not, by clicking on the appropriate button, then open the System Preferences (the icon of the gear that resides on the Dock ) and verify that, inside it, is present the Java icon .
Install JDK.
To install JDK, on the other hand, open this Web page , locate the Java SE Development Kit [xx] downloads section and click on the macOS tab , located a little further down; now, if you have a computer equipped with an Intel processor , click on the download link corresponding to the entry x64 DMG Installer ; if, on the other hand, you have a Mac with a chip from the Apple family (eg Apple M1 ), use the link located under Arm 64 DMG Installer .
In any case, once you have obtained the JDK installation package, open it and double-click on the .pkg file contained within it; when you reach the software installation screen, press the Continue and Install buttons , enter the Mac administration password when prompted and complete the setup by pressing the Install software and Close buttons . Finally, choose whether or not to move the JDK installation file to the trash by pressing the dedicated button.
Open a file.
Once the JRE or JDK software has been installed, running a java file with the .jar extension is a very simple operation: after identifying the icon of the latter, right click on it and select the Open item from the proposed context menu; if necessary, click again on the Open button , in order to overcome the restrictions set by Apple against non-certified developers.
Alternatively, you can also start a jar file directly from the macOS Terminal : you can open the latter by selecting the Go> Mac Utilities menu and double-clicking on the homonymous icon inside it.
Now, issue the command java -jarinside the window that opens, leave a space and drag, still in the Terminal window, the icon of the .jar file to start. Finally, give Enter and wait for the application contained within it to start. For further information, you can take a look at my guide on how to enable Java on Mac , in which I have given you all the details of the matter.
How to run a JAR file: Linux.
On Linux , the issue of installing Oracle Java, both JRE and JDK, gets a little complicated: in fact, using the files provided by Oracle, it is necessary to manually extract the Java components, copy them to the most appropriate directories and define, always manually , the environment variables necessary for the execution of the files, assigning the appropriate permissions for each user.
This procedure can be considerably simplified by installing OpenJDK instead : since it is an open-source version of Java, it is available in the repositories of almost all the most well-known Linux distributions.
Just to give you an example, if you intend to install Java on Ubuntu , open the Terminal by recalling it from the Applications view of the desktop manager, issue the command apt updateinside it and enter , so as to start updating the repositories. When prompted, enter your account password and press the Enter key on your keyboard again to authorize the operation.
At this point, issue the command sudo apt install openjdk-[versione]-jre, to install OpenJDK in JRE version (therefore only the Java execution environment), or sudo apt install openjdk-[versione]-jdk, to install the entire Java development environment. Take care to replace [version] with the most recent version number of the software: for example, to install OpenJDK 18 (the most recent edition at the time of writing this guide), you will have to type the command sudo apt install openjdk-18-jreor the command sudo apt install openjdk-18-jdk.
If you are unsure about the latest edition of OpenJDK available for your Ubuntu version, try doing an apt search by issuing the command apt search –names-only “openjdk-*”.
Once you have given the necessary command, press the S button to confirm the installation of the dependencies and start the software installation and, if prompted, enter your account password and press Enter . Java installation and configuration will take place completely automatically.
At the end of the procedure, you can run the .jar files on your computer by double clicking on the relative icons, or by typing the command, again from the Terminal java -jar /percorso/del/file.jar. That’s all!
How to open JAR files on Android, iOS and iPadOS.
Are you wondering if it is possible to open JAR files on devices equipped with the Android operating system ? Unfortunately, the answer is no. Although the “green robot”, as well as its apps, are written almost completely in Java, the virtual machine used to run the various processes is different.
The computer platforms, through Oracle JRE / JDK and OpenJDK software, provide the Java Virtual Machine (or JVM), capable of managing and executing files with the .jar extension; on Android, on the other hand, there is another virtual environment, called ART (or Android RunTime ), which is not able to operate on “pure” java applications, but can only manage the files contained in the APK packages. The editions of Android prior to 5 used the Dalvik virtual machine , which was also incompatible with jar-type applications.
And on iPhone and iPad ? Well, the situation is not very different: Apple’s operating systems do not implement Java virtual environments at all, therefore it is almost impossible to execute files written in this language, I’m sorry.