- To download and Installation JDK
- To Setting up Java Environment for Windows PC (JAVA_HOME)
- Understand What and Why about JAVA_HOME Environment Variable.
- Create .java file using notepad.
- Write a Simple java program using notepad.
- Compile and Run Java Program using cmd.
Step 5:
Now, We need to Check Java JDK is installed properly or not using CMD.
- Go to run command using windows key + r
- Type cmd
- Now type java -version
- It will display the version name
- Now You are ready to run your first java program.
Step 6:
Open Notepad and create file with .java extension.
In our example, I have created hello.java file. ( The first letter of Filename Should be in capital form)
-
Open Notepad
-
Go to File Ã
Save as
-
It will Open Save as Window
-
Now In Save as window type filename Hello.java
and in save as type Select “All Files”.
-
Click On the Save Button.
Step 7:
Now write and save given simple java program.
public class hello{
public static void main(String args[])
{
System.out.println("Welcome to Java learning with COmputer Bits");
}
}
Note: The first letter of Class name and file name should be in capital form and both are equal.
Watch Tutorial Video on How to run Java program using cmd:
o
Simply open the folder where our hello.java file is.
o
Then in the address bar type cmd.
o It will Open cmd in the current working directory.
- Check out the below image for a better understanding:
- Now type javac hello.java to compile it. It will
generate byte code file with .class extension.
- In our example hello.class file will generate.
- Now, To Run java program write java hello in cmd
- If there is not any error then, we will get output.
- That’s IT. Now you know how to set up, create and
run java program.
0 Comments