The Configuration of JAVA Environment Variables and the Operation of Java Programs

JDK environment variable configuration

After we download and install the JDK on the computer, the operation that needs to be performed is to configure the environment variables, so how to configure the environment variables, then take the win10 system as an example to share with you.

1. Find the bin directory of the JDK, and then copy the address of this directory. For example, mine is installed on the c drive by default, so the address I want to copy is C:\Program Files\Java\jdk-12.0.2\bin

Insert picture description here
2. Find this computer in the computer -> click the right mouse button -> Properties
Insert picture description here
3. Select advanced options
Insert picture description here
4. Click Environment Variables
Insert picture description here
5. Find Path
Insert picture description here
6. Click Edit
Insert picture description here
7. Click New and paste the previously copied address, and finally click OK. We have completed the JDK environment variable configuration Insert picture description here
8. Write a Java program

public class HelloWorld{
    
    
	public static void main(String[] args)
	{
    
    
		System.out.print("Hello World!");
	}
}


Insert picture description here
9. Windows+r–> enter cmd–>enter. 10. Here, because my program is saved in the Java folder of the D drive, we must first switch to the D drive and then find the Java folder, and then enter Javac HelloWorld, java (Javac HelloWorld, java is the name of the source program) compile the program, after the compilation is passed, enter Java Hello World to run the program, and the following is the result of our operation!
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_43825377/article/details/105236741