How to Run a Jar File

preview_player
Показать описание
Follow this step by step guide to learn how to run jar files by executing a simple command in the command prompt.

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

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.
Рекомендации по теме
Комментарии
Автор

Thumbs up for the clearest voice in tutorials ever
!!!

echarit
Автор

Thank you so much. I am far too illiterate in the computering ways to have done this on my own. You have saved me and given me hope. You are a shining light upon the darkness. Thank you so much.

sydmenard
Автор

I spent well over a week trying to figure out how to solve the issue of my PC only wanting to open Jar files strictly as archives instead of the occasional executable. Nothing I tried worked, until I stumbled on this. Not a long-term fix, but it's a work-around that allows my continued computing so all is good. Many internets your direction.

_Xiro.Aour_
Автор

java is not recognized as an internal or external command, operable program, or batch file. Help?

mkonin
Автор

Always love hearing perspectives of other entrepreneurs, keep up the hustle! 🚀

TheMinderEngineer
Автор

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. ;)

taniafonseca
Автор

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
-jar yourjarfile.jar", (if you don't have java in your path)

Datafyi
Автор

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"

pattok
Автор

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

ers
Автор

i accidentialy on my file that was suppose to be run on .exectubale jar file, i did do open-with and i made it run from another file, is there anyway to make it run on exectubale jar file again?

DEFNUB
Автор

Ty so much the other confusing tutorials just made extra unneeded steps +1 sub + like

darkplays
Автор

It is working great solution thanks a lot

AB-llyh
Автор

'java' is not recognized as an internal or external command,
operable program or batch file. What causes this?

SemiCooperative
Автор

this is actually really good tutorial thank u, nice and short and helpful mmm

bruh-fxyc
Автор

When I hit the enter key on the java -jar runable_jar.jar it says Error: unable to access jarfile runable_jar.jar
PLEASE HELP!!

benparker
Автор

thank you so much i have a asus laptop and was impossible to open files that are .jar until now!

legendarycast
Автор

One problem though...
COMMAND PROMPT WILL NOT ACCEPT JAVA AS A COMMAND!!!!

Marccubus
Автор

ahm.. i only get a message saying "java is not recognized as an internal or external command, operable program, or batch file."

Egobyte
Автор

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

furiousmich
Автор

Not working for me with the latest JRE

OzcarMike