Loading...

How to Run a Jar File

Loading...
How to Run a Jar File
Follow this step by step guide to learn how to run jar files by executing a simple command in the command prompt.

Don't forget to check out our site http://howtech.tv/ for more free how-to videos!
http://youtube.com/ithowtovids - our feed
http://www.Facebook.com/howtechtv - join us on Facebook
https://plus.google.com/103440382717658277879 - our group in Google+

Jar stands for Java Archive. These are specifically used by Java Compilers which contains a collection of classes, and other resources used by java program. These files can also be executed on user request.
 
There could be various ways of running jar files but in this article we will teach you to run jar file via command prompt.

Step 1 -- Open the Command Prompt

Running jar files is very easy. 

First of all, press the "windows + r" key to open the run window. Over there, type in cmd and hit the enter key in order to open the command prompt.

Step 2 -- Change directory

Once the command prompt opens, go to the directory where the jar file is saved. In our case, it was saved on the desktop. Thus, we will use the command "cd desktop".

Step 3 -- Enter the command

Once there, type the command "java --jar runable_jar.jar" and hit the enter key. 
The "-jar" attribute is used to run the jar file using the java compiler. After the attribute comes the filename which is runable_jar and .jar is the file extension.

Once the command will be executed, the text present in the file will be displayed in the command prompt. 

For the purpose of this tutorial, "Hello world" was the text present in the file that was part of the archive that we ran.

And this is how we can run jar file.

RRelated Posts

How to open a .jar file Windows 10

This is how to open a .jar file if when you double click it does not open. This should also work on windows 8. I hope this helps all of you with this issue. FIX: Here is a video that I made that

How to Check JRE Version

Follow this step by step guide to learn how to check the Java run time Environment version installed on your machine Don't forget to check out our site http://howtech.tv/ for more free how-to

CComments

  • Aquaa
    IT WONT WORK AND I GOT THE LATEST VERSION!
  • foellerman gaming
    thank you so much i could not open a jar file i wanted to get but this worked thank you
  • jason perez
    Ty so much the other confusing tutorials just made extra unneeded steps +1 sub + like
  • KaJuPe
    I love you.
  • Silver The Gamer
    it can't find the manifest :/
  • Mr_Typlosion
    My java dose not work
  • josh platz
    This is just a temp fix? Or run? Won't open by its self but thank you atleast I got it running
  • Baki Sapak
    Thank you so much! ;) its worked.
  • Xxmaxpower586xX Gaming
    thank you so much i was having issues with .jar files until i watched this video
  • Super B
    I Get "the system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe."
  • Arda Topal
    :(
  • خادم الإسلام
    thnksssssssssssssssssss <3 <3 <3 Big Up it's work correctly 10000% Subscribe + Like + Comment :*
  • classic Sans
    it's says unable access jar file
  • slender
    you are the best!!!
  • Tania Fonseca
    Thank you so much! I've been trying to open an importante JAR file for so long and with your help I was finally able to open it. ;)
  • KiragPGG
    It worked for me
  • SmokeJumper
    THANK U!!!
  • Legendary Cast
    thank you so much i have a asus laptop and was impossible to open files that are .jar until now!
  • Carl Wennerstrom
    I LOVE YOU SO MUCH
  • FuriousMich
    I need help to install optifine on my pc It's a lenovo h50-50 And when I'm trying to open up the optifine installer it says something in the cmd that it didn't load the installer how do I make it load the installer??? And yes I do have java....
  • Mafias815
    Error: unable to access jarfile Mars4_5
  • João Tavares
    Thank you sooooo much!!!
  • Gin Geek
    i was just double clicking on the file and then the jar file will launch now i have to do this everytime
    anyway worked for me good thank you
  • Siliuse
    You have a pleasant voice.
  • UpRoaryus
    Thank you for the handy video ! It helped save me from installing potential adware/malware from an iffy source just to extract a B1 archive. Instead of downloading the sketchy GUI installer/archiver I was able to use the open source tool jar to extract the files myself using the command line without any worries about bundled adware/spyware and could still download whole folders as archives off of the 4shared site without having to pay any premiums for the zip download ability. Now I guess I only need worry if the site added anything to the archive before making it available to download after compression.... I guess there could still be something really sneaky inserted in there, but at least I don't feel like I've actually knowingly invited it by being forced to accept terms bundled into an installation for the gui to unpack the archive for me. =)

    honestly i doh't know WHAT I would do if it weren't for nice folks like you posting helpful tips all over the internet for me to discover and use. knowledge is really power more and more so these days...
    .
  • ShootingOrange
    guys this is what you have to do

    java -jar 'name of your file'.jar
  • Vincent Alvarez
    bu
  • 3593893
    Not working for me with the latest JRE
  • SkyAcer009
    jar file forge for minecraft
  • Chua YW
    For who still cannot run , try type this command javaw.exe -jar yourfile.jar
  • skittle05
    i love u very much!
  • 49 ERS
    hello. great video clear and easy to follow. thank you. now can i do the same on iphone 5s running ios 7,1,2. i transferred the .jar file to my iphone using usb cord to goodreader, but cant seem to open it. cant find a converter or any app to open it. can i use the command prompt to get it to execute on my iphone. thanks in advance
  • K x p p a l o r e s
    love ur funny voice :D
  • Butterand E
    I LOVE YOU
  • 박성훈
    why do i errored Unable to access jarfile runable_jar.jar ?
  • Mywizard125
    Thanks this is great!
  • echarit
    Thumbs up for the clearest voice in tutorials ever
    !!!
  • Rhejdirogth Groatvhe
    Did this and it simply says "Access is denied."
  • bloodw3rx
    UP VOTE THIS.
    If you are getting the "command prompt will not accept java as a command" error, the solution is simple.

    DOWNLOAD THE LATEST JAVA JRE from java.com

    then it'll work.
  • Mike M
    it there an additional way to run it. If I send a jar file to my friend he will just double click it and it won't run.
  • Templar44
    Thank you!
  • mikael sahlin
    Hi great video simple, fast and well explained. If my java program needs inputs to run, either options or files. how would I do this from the command line?
  • patto2k
    Thanked you. this worked like a charm.
    Another tip is making a batch file in your PATH such as runjar.cmd that includes "java -jar %1"
  • Baronvondeath
    Thank you ^.^
  • Seyhun ÖZKAYRAN
    thanks it work very well. it may confuse people doesn't get well. for example my jar file to run is hypercon. so my command is java -jar hypercon.jar ;)
  • Gazer01 AMVs
    do i do the same on a laptop?
  • Noam Bahar
    Does not work when I type in cd desktop
  • DataFYI Corporation
    If the java command will not run (and you know you have java installed), you will first need to add the java bin directory path to your environment, or find the path (usually in your Program Files folder, i.e. C:\Program Files\Java\jdk1.5.0_09\bin,
    then run "java -jar yourjarfile.jar" (if you have java in your path),
    OR
    ""C:\Program Files\Java\jdk1.5.0_09\bin\java" -jar yourjarfile.jar", (if you don't have java in your path)
  • Yuh Boi Guzma
    One problem though...
    COMMAND PROMPT WILL NOT ACCEPT JAVA AS A COMMAND!!!!
  • Yuji Okitani
    THX!