Javase environment configuration in eclipse

Source: Internet
Author: User

This thing to configure a lot of things "environment variable" ' JDK Configuration ' ' Configuration successful unsuccessful you can start running →cmd→ input "Java-version" if the version of JDK is displayed "then you have the configuration successfully attached configuration method: Download the good JDK is an executable installer, double-click Install. Change the installation path to: C:\jdk1.6.0 (other paths, of course).

After the JDK installation is complete, we will set the environment variables:

Right click on my Computer, select "Properties", select "Advanced" tab, enter the environment variable settings, set the following three environment variables:
(1) Set the path variable, so that we can run Java applications anywhere in the system, such as Javac, Java, Javah, etc., this will find our directory to install JDK, such as our JDK installed in the C:\jdk1.6.0 directory, then the C \ Jdk1.6.0\bin directory is our common Java application, we need to add C:\jdk1.6.0\bin this directory to the PATH environment variable inside.

Find the path variable in the system variable, select-edit; (There are already a lot of variable values, is the value of the variable at the front plus C:\jdk1.6.0\bin;)
Variable Name: path
Variable value: C:\jdk1.6.0\bin;

(2) The CLASSPATH environment variable is when we need to refer to someone else's written class when developing a Java program, let the Java interpreter know where to look for this class. In general, Sun provides us with some extra rich class packages, one is Dt.jar, the other is Tools.jar, and these two jar packages are located in the C:\jdk1.6.0\lib directory, so we usually Will add these two jar packages to our CLASSPATH environment variable set classpath=.; C:\jdk1.6.0\lib\tools.jar; C:\jdk1.6.0\lib\dt.jar.

In the system environment variable, click the new classpath
Variable name: classpath
Variable value:.; %java_home%\lib\tools.jar;%java_home%\lib\dt.jar; (Note that there is a "." in front of classpath. , which indicates the current directory, so when we run Java AClass, the system will look for the AClass file in the current directory first. );

(3) Set Java_home:

One is to facilitate the reference, for example, the JDK installed in the C:\jdk1.6.0 directory, then set Java_home as the directory path, then to use this path later, just enter%java_home%, to avoid each reference to enter a long path string;

The second is a principle, when the JDK path changes, only need to change the value of the java_home variable, otherwise, it is necessary to change any of the absolute path references to the JDK directory document, if there is no change, a program can not find the JDK, the consequences are imagined----system crashes!

Thirdly, third-party software will refer to the agreed-upon java_home variable, otherwise you cannot use the software normally.

New Java_home (Java_home points to the JDK's installation path) in the System environment variable column
Variable name: java_home
Variable Value: C:\jdk1.6.0

Configuration complete Write a simple Java program below to test whether the J2SDK has been successfully installed:

public class helloworld{

public static void Main (string[] args) {

Ystem.out.println ("Hello world!");

}

}

Save the program as a document named Helloworld.java.

Open a Command Prompt window, go to the directory where Helloworld.java is located, type the following command

Javac Helloworld.java

Java HelloWorld

At this time if print out HelloWorld is installed successfully, if not print out this sentence, carefully check the above configuration is correct.

Javase environment configuration in eclipse

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.