How to run Java program in command prompt

First of all you need to install JDK (Java Development Kit) in your computer. To do that go to the Oracle site. Once you landed over that Oracle site you can find JDK just like below two circled areas.

Click on any one of the Download button on the page and click on that accept the terms and conditions radio button and click on either 32bit windows or 64bit windows

Install the JDK in your system. Once it is done you can find the application in " C:\Program Files\Java\jdk1.8.0_45\bin ".

Copy that java path directory and open the " Environment Variable " through Start Menu just like below picture.

Click on that "Edit the system environment variables". Now click on that "Environment Variables" button appeared from the new dialog box.

Now it will open Environment Variables dialog box, where you need to find a system variable called "Path". Click on it and press that "Edit" button.

Once you opened "Environment Variable" you can find a variable called "Path", click on it and press "Edit" button. Now you need to enter the location of the java application that has been installed, just like this " ;C:\Program Files\Java\jdk1.8.0_45\bin; ".

And then press that "OK" button. Now open Command Prompt and type "javac" you should get just like below picture showing.

Only then it states that you have successfully created a variable path in the system. Now you can run the java program on command prompt with ease :)

For any further doubts or queries you can comment below and I will reply. Thank you for landing by.

Tags: how to, java program in command prompt, cmd, windows 7, environment variable, set path, jdk latest version, free downloads, oracle, 

Post a Comment

Feel free to ask your queries, happy to discuss with you.