Configuration of JDK and eclipse Environment Variables

Source: Internet
Author: User
Download and install JDK and configure Environment Variables

To download and install JDK, follow these steps:
1. Click the following URL to enter the jdk1.5 download page: http://java.sun.com/j2se/1.5.0/download.jsp
2. Click "Download JDK 5.0 Update 6 ":

Configure the JDK environment variables as follows:
1. Right-click "my computer" and click "properties": Select the "advanced" tab and click "environment variables ":
2. In "system variables", set three attributes: java_home, path, and classpath (case-insensitive)
Java_home indicates the JDK installation path, which is the path c: \ Program Files \ Java \ jdk1.5.0 _ 06 during installation. This path includes Lib, bin, JRE and other folders (it is best to set this variable, because later running tomcat, Eclipse, etc. all need to follow * this variable );
Path allows the system to recognize Java commands in any path. Set it to % java_home % \ bin; % java_home % \ JRE \ bin
Classpath is the path of the Java loading class (class or Lib). Only the class in classpath can be identified by Java commands and set :.; % java_home % \ Lib; % java_home % \ Lib \ tools. jar (to add. indicates the current path)
% Java_home % refers to the previously specified java_home.
3. "Start"->; "run", type "cmd ":
4. type the command "Java-version". If the screen is displayed, the environment variable is configured successfully:

Note: The user variable setting takes effect only after the logon is canceled and the system variable is not used.

====

Eclipse is a development environment based on the Java platform. It must also run on the Java Virtual Machine and use the JDK compiler. Therefore, we must first install JDK. Jdk1.4 is currently the most stable version, and is also a required condition for eclipse operation. First download the jdk1.4 installation from Sun's official site http://java.sun.com, you can set the installation directory, I install it to the D: \ Software \ j2sdk1.4 directory. Next, configure the environment variables so that the Java program can find the installed JDK and other configuration information. Right-click "my computer" and select "properties". In the displayed dialog box, select "advanced" and "environment variable" to see the environment variable dialog box:

The preceding user variables are valid only for the current user. The following are system variables, which are valid for all users. If you want all users to use it, click "new" under the system variable and fill in:

Java_home is the JDK installation directory. Many development environments that depend on JDK depend on it to locate JDK. Therefore, it must be correct.

Next, find the system variable path, click "edit", and add the directory where the JDK executable file is located, namely % java_home % \ bin. My corresponding directory is D: \ Software \ j2sdk1.4 \ bin, which must be appended to the path. Separate them with semicolons:

NOTE: If multiple Java virtual machines are installed in the system (for example, if Oracle 9i is installed with jdk1.3), you must put the jdk1.4 path in front of other JVMs; otherwise, an error will be reported when eclipse is started.

The last system variable is classpath. the Java Virtual Machine searches for the directory where the class file is located based on the classpath settings. However, this is not required. You can specify classpath when running the Java program, for example, when running a written Java program in eclipse, it will automatically set classpath, but in order to run the Java program conveniently on the console, I suggest setting a classpath, set its value to ". ", note that it is a point". "indicates the current directory. Users who are familiar with windows may think that the Java Virtual Machine will search for the current directory during the search. In fact, this is a UNIX habit, out of security considerations. Many beginners of Java are eager to write hello and world programs in the book, but Java pops up. lang. noclassdeffounderror is actually not configured with classpath, as long as you add a current directory "..

Related Article

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.