JDK under Windows Why Configure environment variables (references)

Source: Internet
Author: User

Http://zhidao.baidu.com/link?url=QEPc9sXwf7XSeNjCaqGxUJTbF_liB04AAWPfT_ Lzuifixjw63mqozld5a1fazg64ujsiovvqjg0zchmpm4sqnjl3_afqhj4c6v0izmbnw1c

Answer this question

The first thing to understand is what is path (environment variable)?

Path (environment variable) is a pre-dos internal command that Windows continues to use today. When running a command, a command or file cannot be found locally and will be found in the directory of the Declaration.

And what is JDK,JRE?
JDK (Java Development Kit), Java Development tools
JRE (Java Runtime Environment), Java Runtime Environment

Because Java has to be compiled to run, compiling will be done by common commands such as: compiling Javac, etc.
These common compile commands are stored in the JDK's Bin directory

When Windows runs the Java Compile command, it does not find a command or file locally, and it goes to path to find
It is not possible to place the JDK in the same directory as each Java file, so the JDK is placed in the PATH environment variable so that each Java file can be compiled with a compilation command found in the JDK directory set in Path
In general, Java is used to run commands under the Bin folder in any directory. The Java Bin directory is declared to path.

The compiled class class will be run through the JRE runtime environment.

This is only required for text editing in Java, setting environment variables, etc.

If you do not need to set up with the development tools MyEclipse, myeclipse with the JDK, you do not need environment variables
When the eclipse starts, it will require path, which can either set path or not, and the method is not set:

In the Eclipse.exe directory there is a Eclipse.ini file to configure
Like what

-vm
C:\Java\jre1.6.0\bin\javaw.exe
Mine is.
-vm
C:\Program Files (x86) \java\jdk1.6.0_21\bin\javaw.exe
To set up a virtual machine

You can place the JDK in your Eclipse folder, configure its directory, and not rely on the local JDK to run
And then we can start.

It's a little irrelevant.

What happens in the run

Like what:
Helloworld.java in D:\test directory (first program output HelloWorld)
D:\test>:javac Helloworld.java//javac Compiling Helloworld.java file
The first window to find Helloworld.java files in the directory where the Javac command, there is to compile, do not find the path, according to the path directory defined in the system to find Javac command, found to compile, not found on the report is not external internal command error
D:\test>java HelloWorld//compile run compiled file from Java HelloWorld
First, the window to find the directory where the Helloworld.class file has a Java command, run, do not find path, according to the path directory defined in the system to find Java command, found to run, not found on the report is not an external internal command error
HelloWorld//Output result
D:\test
This is my manual editing, if this is the ideal.

There is no clear, can hi i
Questioner evaluation
Thank you so much!!!

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.