Picture of Programing with Java using Command Prompt

This instructable will teach you how to: 

1. Install the Java Development Kit.

2. Set system variables to easily be able to compile and execute java files.

3.  Compile and execute a Java file from Command Prompt.  

** This is mainly for Windows 7 and Vista.

Step 1: Download latest JDK

Picture of Download latest JDK
1.Follow this link: http://www.oracle.com/technetwork/java/javase/downloads/index.html
2. Click Download JDK under the download Java Standard Edition panel.
3. Choose your operating System and agree to the terms of service. **
** This will  probably be Windows since your using Command Prompt.
RubénR81 month ago

Hi, the tutorial has been really helpful, I have some questions, though:

1. Why do we have to type "set Path=C:\Program Files\Java\jdk1.6.0_21\bin" and "set Path=C:\Program Files\Java\jdk1.6.0_21\bin"? I tried just typing either one and it compiled just fine

2. Is there any difference between "set Path=C:\..." and "set PATH=%PATH%;C:\..." (besides the syntax)?

Thanks in advance :)

sudeeps13 months ago
In cmd javac myprogramme.java,it takes few sec and there is no error but in cmd java myprogramme,there is a msg shown is-
Error:Could not find or load main class myprogramme

plz tell me how short out this prob??
avinashd11 months ago

Truely great................. Thats all i want to say

works 100%....


AatmanS1 year ago

This works 100% fine. Thanx for adding it on net.

mk123451 year ago
with these we have to take care of the spell and case of the class