In order to create a .jar file, you need to use jar instead of java:

jar cf myJar.jar myClass.class

Additionally, if you want to make it executable, you need to indicate an entry point (i.e., a class with public static void main(String[] args)) for your application. This is usually accomplished by creating a manifest file that contains the Main-Class header (e.g., Main-Class: myClass).

However, as Mark Peters pointed out, with JDK 6, you can use the e option to define the entry point:

jar cfe myJar.jar myClass myClass.class 

Finally, you can execute it:

java -jar myJar.jar

See also

  • Creating a JAR File
  • Setting an Application's Entry Point with the JAR Tool
Answer from João Silva on Stack Overflow
Discussions

Cannot Open .jar files
When I try to open a .jar file, nothing happens. No error messages or prompts. Has anyone encountered a similar issue on Windows 11, and if so, how did you resolve it? I would greatly appreciate any tips, or suggestions to get .jar files working smoothly on my system. More on learn.microsoft.com
🌐 learn.microsoft.com
4
5
December 29, 2023
Can someone give me a tutorial on how to open .JAR files?
By open do you mean run? Or pull up the JAVA code so you can alter it? If you just mean run, download the JAVA runtime and install it, then just double click the .jar file. Jar files are compiled, so you'd need a decompiler to get the editable code, if it's possible at all. More on reddit.com
🌐 r/WindowsHelp
10
1
February 8, 2022
How to make a .jar file
Why are you trying to edit the mod.jar directly? You can use datapacks to modify this stuff, which is the intended route. https://github.com/apace100/origins-fabric/wiki More on reddit.com
🌐 r/feedthebeast
6
2
February 23, 2021
How to run jar files using powershell

Should be a few ways to go about it...

# Directly invoke it
java -jar gerrit-2.15.4.war init –-batch -–no-auto-start -d gerrit_slave

# Using &
& java "-jar gerrit-2.15.4.war init –-batch -–no-auto-start -d gerrit_slave"

# Using Start-Process
Start-Process -FilePath java.exe -NoNewWindow -Wait -ArgumentList @(
    "-jar gerrit-2.15.4.war"
    "init"
    "–-batch"
    "-–no-auto-start"
    "-d gerrit_slave"
)
More on reddit.com
🌐 r/PowerShell
4
3
August 16, 2019
🌐
TheServerSide
theserverside.com › blog › Coffee-Talk-Java-News-Stories-and-Opinions › How-to-open-a-JAR-file
How to open a JAR file
You can open JAR files with any ZIP utility. A JAR file is just a special type of ZIP file. And to run a Java JAR file, just install Java and either double-click it or run the JAR file at the ...
🌐
Oracle
docs.oracle.com › javase › tutorial › deployment › jar › unpack.html
Extracting the Contents of a JAR File (The Java™ Tutorials > Deployment > Packaging Programs in JAR Files)
The f options indicates that the JAR file from which files are to be extracted is specified on the command line, rather than through stdin.
🌐
How-To Geek
howtogeek.com › home › windows › how to open jar files on windows 10 and 11
How to Open JAR Files on Windows 10 and 11
September 23, 2023 - He prefers eating healthy items, but eating some junk every once in a while is okay for him. ... To run a JAR file on Windows 10 or Windows 11, right-click it, then select Open With > Java Platform SE Binary.
🌐
Computer Hope
computerhope.com › issues › ch001343.htm
How to Open a Jar File
In the Edit environment variables window, check if the Java folder path to the java.exe file exists in the Path variable. The folder path should look similar to one of the examples below. ... If you do not see the Java folder path, add that folder path to the Path variable. Click OK on each open window, and then restart your computer. How to restart Microsoft Windows. Try double-clicking the jar file again.
🌐
Baeldung
baeldung.com › home › java › guide to creating and running a jar file in java
Guide to Creating and Running a Jar File in Java | Baeldung
4 days ago - The javac command creates JarExample.class in the com/baeldung/jar directory. We can now package that into a jar file. To create the jar file, we are going to use the jar command.
Find elsewhere
🌐
Packagecloud
blog.packagecloud.io › inspecting-and-extracting-jar-files-from-the-command-line
Inspecting and extracting JAR files from the command line | Packagecloud Blog
May 12, 2023 - This post covers how to use `jar` or `unzip` command-line to manipulate 'jar' files.`jar' is native to JAR files and is recommended but `unzip` is available by default on most operating systems.
🌐
SysAdminSage
sysadminsage.com › home › blog › how to get jar files | download and use easily
How To Get Jar Files | Download And Use Easily - SysAdminSage
December 28, 2025 - Learn how to get jar files effortlessly by downloading from repositories, extracting via command line or IDE, and adding them to your Java projects using popular tools like Maven and Gradle.
🌐
GeeksforGeeks
geeksforgeeks.org › java › jar-files-java
JAR files in Java - GeeksforGeeks
January 7, 2026 - META-INF/MANIFEST.MF: This is the manifest file, which stores metadata about the archive. ... To extract the contents of a JAR file, use the x (extract) option.
Top answer
1 of 4
12

Hi

Welcome to Microsoft community.

I understand you're facing issues with opening .jar files on your Windows 11 system, even after using the Jarfix tool. Let's try some additional troubleshooting steps to resolve the problem:

  1. Reinstall Java: First, ensure that you have Java installed on your system. If it is already installed, try reinstalling it to ensure that all necessary components are properly configured. You can download the latest version of Java from the official Java website (java.com).
  2. Check File Associations: Confirm that the .jar file extension is associated with Java. To do this, right-click on a .jar file, select "Open With," and choose "Choose another app." From the list, select Java (or browse to the Java executable file) and check the box that says "Always use this app to open .jar files." This will ensure that .jar files are opened with Java by default.
  3. Command Line: Try running the .jar file from the command line. Open the Command Prompt or PowerShell, navigate to the directory where the .jar file is located, and use the command "java -jar filename.jar" (replace "filename.jar" with the actual name of the .jar file). This will attempt to execute the .jar file using the Java runtime environment.
  4. Check Java Version: Make sure that you have the latest version of Java installed on your system. Older versions may not be fully compatible with Windows 11. Visit the official Java website to download and install the latest version.
  5. Update Windows: Ensure that your Windows 11 system is up to date with the latest updates. Sometimes, system updates can resolve compatibility issues that may be causing problems with .jar files.

If none of these steps resolve the issue, it might be helpful to provide more details about the specific error messages or behaviors you encounter when trying to open .jar files. Additionally, you could consider seeking assistance from the Java community or contacting the support team for the application or program associated with the .jar file you're trying to open.

Best regards

Derrick Qian | Microsoft Community Support Specialist

2 of 4
1

same, but I was using windows 10.

🌐
Software Testing Help
softwaretestinghelp.com › home › open files › how to run & open a jar file (.jar file opener)
How To Run & Open A JAR File (.JAR File Opener)
April 1, 2025 - There are many tools available online that you can use to open the JAR files. Select one of the tools and open it in your browser. Go to select files and select the file you want to open. Click on the extract option to get the list of contents in the JAR archive.
🌐
Oracle
docs.oracle.com › javase › tutorial › deployment › jar › build.html
Creating a JAR File (The Java™ Tutorials > Deployment > Packaging Programs in JAR Files)
The basic format of the command for creating a JAR file is: ... The c option indicates that you want to create a JAR file.
🌐
Tomtom
engineering.tomtom.com › create-java-jar
TomTom Engineering Blog - Back to Basics: How to create a java JAR using command line
June 11, 2023 - In order for the JVM to understand our java code, we need to transform it into bytecode. We can do this with the javac command, followed by our java file name. So the name of the file, not the name of the class inside the file: ... If the compilation is successful, meaning we have no errors in your code, the result of this command will be a file called MyJavaFile.class. A manifest file is a crucial component of a JAR file.
🌐
Medium
joshiadvait8.medium.com › how-to-create-jar-file-easy-way-of-jar-from-java-files-b8c916ab291e
How to create jar file | easy way of .jar from .java files | by Advait Joshi | Medium
April 10, 2021 - 3. now let create a manifest.mf file like following which contains the name of your class which contains main method that is your entry point make sure here to give class name with package name shown in image below, Keep in mind to write it like this after: there is space and one extra new line at end of file ... 4. Now most important part is to create jar file using cmd this command ship from jdk no need to add any other library
🌐
Wikihow
wikihow.com › computers and electronics › software › file manipulation › 3 ways to extract a jar file - wikihow
3 Ways to Extract a JAR File - wikiHow
June 20, 2025 - Popular versions of Linux, such ... right-click menu: right-click the JAR file you want to extract, click Extract Here, click Close when prompted, and open the folder that's named after your JAR file....
🌐
Linux Mint Forums
forums.linuxmint.com › board index › main edition support › beginner questions
[SOLVED] How to run a .jar file - Linux Mint Forums
What Java software are you trying to run? You must have a Java runtime installed. You must also run the command in the folder where the java .jar file is or create a new desktop shorrtcut launcher to that file using "java -jar " in front of the location path and filename
🌐
ezyZip
ezyzip.com › home › extract › extract jar file
Open JAR Files Online (No Upload - 100% Private) - ezyZip
Open & extract java JAR file in your browser for 100% FREE! No uploading/downloading required!
🌐
TheServerSide
theserverside.com › blog › Coffee-Talk-Java-News-Stories-and-Opinions › Run-JAR-file-example-windows-linux-ubuntu
How to run a Jar file
Furthermore, the class with the main method must be listed as the main-class in the JAR’s manifest file. If not, the class must be explicitly stated on the command line when the JAR is run. As long as you have Java installed, and the PATH variable points to the \bin directory of the JDK, you issue the following command to run a JAR file at the command line: