Steps to Create and Run My First Java Program
-
Open a web browser.
-
Download the Oracle JDK installer.
-
Go to Control Panel.
-
Open System and Security.
-
Click on System.
-
Select Advanced system settings.
-
Go to the Advanced tab.
-
Click on Environment Variables.
-
Under System Variables, select Path and click Edit.
-
Add a new path for the JDK’s bin directory:
F:\Java
-
Open Command Prompt.
-
Open Notepad.
-
Write the Java code to print Hello World!.
-
Save the file as HelloWorld.java.
-
Navigate to the folder where the file is saved.
-
Open Command Prompt in that folder.
-
Compile the program using:
javac HelloWorld.java
- Run the program using:
java HelloWorld
- The program will display:
Hello World!