0% found this document useful (0 votes)
5 views2 pages

Java Setup and First Program Guide

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Java Setup and First Program Guide

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Step-by-Step Guide

Step 1: Install Java

1. Download and install the Java JDK from the official Oracle website.

Set the environment variable


2. After installation, set the environment variable (PATH):
o Go to System Properties → Advanced → Environment Variables
o Under System Variables, find the Path variable and add the path to the bin
folder of your JDK (e.g., C:\Program Files\Java\jdk-17\bin)

Step 2: Write Java Code in Notepad

1. Open Notepad.
2. Type a simple Java program:

3. Save the file with .java extension, e.g., [Link].


o Make sure to select "All Files" in the "Save as type" dropdown.
o Save it in a folder, e.g., C:\JavaPrograms

Step 3: Open Command Prompt

1. Press Win + R, type cmd, and hit Enter.


2. Navigate to the folder where the file is saved:

EX:

cd C:\JavaPrograms

Step 4: Compile the Java Program

EX:
javac [Link]

 This command will create a [Link] file in the same folder.


 If there is any syntax error, it will be shown in the command prompt.

Step 5: Run the Program

EX:
java HelloWorld

 Output should be:


 File name must match the public class name ([Link] contains public class
HelloWorld).
 Use Notepad++ or other editors for better formatting and highlighting.
 Java is case-sensitive, so be careful with spelling.

You might also like