Jdk1.7 configuration and Testing

Source: Internet
Author: User

Configure JDK 1.7 environment variables in Windows 7 (found online, clearly written, and saved)

Environment: win7 (32-bit)
Jdk1.7


1.
Right-click "computer"> "properties"> "Advanced System settings"> "advanced"> "environment variables". The "environment variables" dialog box is displayed. You can change the environment variables instead of the Administrator. (Otherwise, other users have to configure their own)
Add java_home to specify the JDK installation path, such as c: \ Program Files \ Java \ jdk1.7.0. This path contains Lib, bin, JRE, and other folders.
2. Add the following in the PATH variable:
Set to: % java_home % \ bin; % java_home % \ JRE \ bin; PS: Semicolon is mainly used to separate the JDK path and the path of other system programs and applications.
3. add the classpath variable to the (class or Lib) path of the Java loading class. (This way, when the Java VM loads the class file, it will know where to find the class. Only the class in the classpath can be identified by the Java command)
Set :.; % java_home % \ Lib; % java_home % \ Lib \ tools. jar (to add. indicates the current path. The current path indicates the place where the class file of the program you compile and run is located)

Test whether the configuration is successful: in DOS, various Java commands should appear after you enter the Java press Enter command;
Related compilation commands will also appear in javac;
Java-version indicates the JDK version. PS: note that both Java and javac are commands (verbs). Later versions can be understood as objects with spaces in the middle. Remember !!!
Note:


In cmd, enter
The Set java_home command shows the JDK installation directory;
Set Path shows the value of the PATH variable and the execution path of various programs.
Set classpath to view the class loading path

◆ The end of environment variable values can be added with or without semicolons. Different values are used. (remember: semicolons are used to separate values. As long as they are two different paths, they must be separated by semicolons)
Test whether the configuration is successful: in DOS, various Java commands should appear after you enter the Java press Enter command;
Related compilation commands will also appear in javac;
Java-version indicates the JDK version. PS: note that both Java and javac are commands (verbs). Later versions can be understood as objects with spaces in the middle. Remember !!!
Note:


In cmd, enter
The Set java_home command shows the JDK installation directory;
Set Path shows the value of the PATH variable and the execution path of various programs.
Set classpath to view the class loading path

◆ The end of environment variable values can be added with or without semicolons. Different values are used. (remember: semicolons are used to separate values. As long as they are two different paths, they must be separated by semicolons)

◆ In the classpath variable value, "." indicates the current directory. In addition, the java_home variable is referenced by path and classpath. The advantage is that after you reinstall JDK in the future, you only need to change the value of java_home.

Test instance (Hello World)

Create a text file with the following content:

Public class helloworld {
Public static void main (string ARGs []) {
System. Out. println ("Hello world! ");
}
}

Save, name it helloworld, and change the TXT suffix to Java, that is, the full name of the file is helloworld. Java

Note: The name must be the same as the class name in the text (case sensitive); otherwise, a compilation error occurs.

In the CMD window, enter the file directory and start compiling:

Javac helloworld. Java

After the compilation is successful, the helloworld. Class file appears and then runs

Java helloworld

The result is displayed.

Hello world!

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.