Run Java from Comand Prompt

Hy guys!                                                                                                                 Today i am going to show you how to run java from Command Prompt. You are going to learn to setup the environment variables to run java using Command Prompt. So, here we go:

To run java you must install JDK. If you dont have it download it from :

Setting Environment Variables:

  •      Right Click Computer
  •      Click Advanced System Settings under properties
  •      Click New  under Environment Variables
  •      Set ”path” as Variable name
  •      For Variable value you need to go to the folder where you installed JDK
  •      Inside JDK installation directory open subdirectory bin
  •      Right Click any file inside that directory Under properties
  •      Copy the address of the file that address is Actually the Variable value of   variable path press “ok”

To make it easier here is the image which is going to help you : Run java from command prompt


Open Command Prompt  and type  javac alot of crap will show up. This is the indication that you’re ready to go!

In Command Prompt change your current directory to the directory in which u saved the file which u want to run

type java  is the command to execute the java code FileName is the name of .class file.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s