Java Runbook
1. Download and Install Java – Windows Operating System
Step 1: Visit the official Oracle website https://www.oracle.com/in/java/.
Click on the Download Java
Step 2: The latest version is JDK 23 and there are options for Linux,
macOS, and Windows. Click on the Windows option and then click the
x64 Installer option to download the file for 64-bit Windows OS. OR
simply click this link to install Java for windows 64 bit.
Step 3: Go to Downloads and double-click on that downloaded jdk-
23_windows-x64_bin.exe file. The Java Installation window gets
opened and then click Next button.
Again, click on the Next button to install JDK.
The installation will begin-
Now click on close to finish.
Setting Environmental Variables: -
Step 4: Set the environment variables for Windows OS. Open the C
drive, go to Program Files > Java > jdk-23 > bin folder. Copy the
path, it will be used to configure the environmental variables.
Search for environment variables on the windows search bar, then click on
the Environment Variables button.
Under the Advanced category, click on environmental variables and click
OK.
In the system variable section, select the path variable and then click the
option Edit.
Click New to add a new command and paste the path that we had copied
earlier, and click OK to save the changes.
Verification: -
Step 5: Verify the Installation. Open command prompt (windows +R and
type cmd) and type a command to verify the Java version that is installed
in the system.
java --version
Running our first Java program, to do this, follow the below steps:
Step 1: Open D Drive, and in the drive, create a text file and then
change the file name with .java extension. For E.g.: file.java.
Step 2: Now, write a simple Java code in notepad.
Right-click on the file.java and then select open with > Notepad.
Inside the file, write the Java code.
Figure 1:An easy code to display the words"hello world!"
A more accurate but longer way would be to go to notepad and copy
the code given above. Then save the file with a .java extension and
save it in D Drive.
IMP POINT: In Java, the class name should be equivalent to the file
name. In this case, the file name is file.java, so the class name
inside the file should be file.
Step 3: Open command prompt and navigate to the D drive, where
the file.java is located. To do this, type “dir.” This shows you the
contents or directory of the drive.
Step 5: Compile the Java program. The javac command is used to
compile the Java program.
To do this, enter the following code;
We have successfully run our first Java program on Windows OS.
There are other simple programs that we can display in command prompt
however there are certain points to note.
Calculations and operators cannot be displayed in command prompt
as they will not display the output.
Complex codes cannot be displayed in cmd.
Notepad; being a simple writing software does not provide all key
functions of java.