- To download the JDK file
- Next, download the JRE file.
- After clicking, another window will appear where you can click to download the JRE file.
- After clicking, another window will appear where you can download the JRE file.
- View the file that has been downloaded:
- After downloading, please install it on your computer.
- Next, we will see the Java folder created in Drive C:\Program Files\Java
- Example: We have a Java code file named PersonalInfo.java, which has the same name as the class PersonalInfo.
// Personalinfo.java
public class Personalinfo {
public static void main(String[] args) {
// Print "Information" to the console
System.out.println("My name: Him Seanghon");
System.out.println("Occupation: Teacher");
System.out.println("Department: ICT_PIKT");
System.out.println("Institute: PIKT");
}
}Watch the video:
- Step 1: After writing the code, save the file as PersonalInfo.java in the following location:
- Step 2: We need to compile it (javac file.java) by executing the following command:
For (jdk-23), it depends on your installed Java version. After compiling, a file in byte-code format will be created with the same name as the class, having the .class extension — PersonalInfo.class, which is the executable file.
- Step 3: After successful compilation, we need to run the program (java file) to display the output of our code by executing the following command:
Note: When running the program, do not include the .java or .class extension.
Ebook: https://softkhpc.blogspot.com/2025/05/java-programming-ebooks.html

