Page 240 - PowerPoint Presentation
P. 240
CAVITE STATE UNIVERSITY
TRECE MARTIRES CITY CAMPUS
Department of Information Technology DCIT 111 - Advanced Programming
- Then paste it in the variable value (C:\Program Files\Java\jdk1.8.7_00\bin;
C:\Program Files\Java\jre1.8.0_77\bin)
- Then add a semicolon and a dot at the end of the copied address. (C:\Program
Files\Java\jdk1.8.7_00\bin; C:\Program Files\Java\jre1.8.0_77\bin;.)
How to set Permanent Path of JDK in Windows 10
- Go to Control Panel
- Go to System and Security
- Click the System
- Click the Advanced System Settings
- Go to Environment Variables
- Go to System Variables
- Click the variable Path
- Copy the address/location of your Java (C:\Program
Files\Java\jdk1.8.7_00\bin)
- Go back to the Edit System Variable
- Don’t delete the existing path
- In the Variable value: add to the end of the variable value a semicolon (;)
- Then paste the copied address/location next to the semi colon
(existing_path_etc;C:\Program Files\Java\jdk1.8.7_00\bin;
- Then go to the JRE bin folder, copy the address/location
- Then paste it at the end of the Variable value. (existing_path_etc;C:\Program
Files\Java\jdk1.8.7_00\bin;C:\Program Files\Java\jre1.8.7_00\bin;)
- Click OK until everything is closed.
- Open a command prompt, then type javac. It must show all the available path.
- Then open again the Advanced System Settings
- Go to Environment Variable
- On the User variables
- Click New Button then
- Set the Variable name as JAVA_HOME (Variable name: JAVA_HOME)
- Set the Variable value the path of jdk folder. (Variable value: C:\Program
Files\Java\djk1.8.7_00)
- Then Click Ok until everything is closed.
First Java Program (Hello World!)
Let’s create the hello java program:
class HelloWorld {
public static void main(String[] args) {
System.out.println( “Hello World!”);
}
}
save this file as HelloWorld.java
To compile: javac HelloWorld.java
To execute: java HelloWorld
Compilation Flow
When we compile Java program using javac tool, java compiler converts the source
code into byte code.
Java Code Compiler Byte Code
HelloWorld.java HelloWorld.class
16