When do I need to set Java environment variables?

Source: Internet
Author: User

1. You do not need to configure environment variables when using myeclipse for development. Because myeclipse is an integrated IDE, JRE is specified in it. The configuration of environment variables is irrelevant to development. environment variables are used for finished products.
2. You do not need to set the classpath environment to change unless you use the javac command in the command line to compile the Java program.
As described in other Java tutorials, set the classpath environment variable to D: \ JDK \ Lib \ tools. jar; D: \ JDK \ Lib \ DT. jar, which has no effect on Eclipse running.
3. if the local machine only installs a dedicated jre, it does not need to set the pathenvironment. After JDK is installed, several key files such as java.exe will be copied to the c: \ windows \ system32 directory, which already exists in the PATH variable. Of course, if D: add the \ JDK \ bin path to the PATH variable, which has no impact on Eclipse running.
4. if multiple versions of JRE are installed on your computer, you must set three environment variables java_home, path, and classpath. We recommend that you keep only one version of JRE in the system.
5. How to Set Windows environment variables: Right-click "my computer", select "Properties> advanced> environment variables", and create or modify environment variables in the system variables column.
6. If "'java' is not an internal or external command…" is displayed when you run the Java-version command ...", Add D: \ JDK \ bin to the path environment variable.
7. if "1.5.0 _ 09" is not displayed after Java-version is executed, but "1.3" or "1.4", this indicates that other versions of JRE are installed in the system: the position of \ JDK \ bin refers to the forefront of the PATH variable value and sets the java_home value of the environment variable to D: \ JDK. For example, after installing Oracle 9i, the current JRE will be changed to version 1.3 JRE, which will cause eclipse to fail to start.
8. You can also use % variable % to replace the variable value when setting the environment variable. For example, you can set % java_home % \ bin as the PATH variable. % java_home % \ Lib
9. After JDK is installed, enter Java-version in cmd to verify the installation integrity.

1. java_home indicates the JDK installation path, which is the path selected during installation (assuming that the installation is in c: \ Program Files \ Java \ jdk1.6.0 _ 21). This path includes Lib, bin, JRE, and other folders (it is best to set this variable because Tomcat and eclipse will all depend on this variable in the future ).

2. Path allows the system to recognize Java commands in any path. Set it to % java_home % \ bin; % java_home % \ JRE \ bin.

Note: It is best to put it at the beginning of the path to prevent unfound errors, such as (% java_home % \ bin; % java_home % \ JRE \ bin; % SystemRoot % \ system32; % SystemRoot %; % SystemRoot % \ system32 \ WBEM; D: \ Program Files \ mysql \ MySQL Server 5.1 \ bin)

3. classpath is the Java class or lib path. 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)

Note:
◆ There is no symbol at the end of the environment variable value. Different values are separated by commas :).
◆ "." In the classpath variable value indicates the 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.