Download and install JDK, and configure java environment variables.
To write programs in java, you must build a java Development Environment. You must install jdk and configure environment variables.
I. Download jdk. The mainstream jdk is sun's jdk. Of course, IBM and some other commercial companies have developed their own jdk to improve programming efficiency, here we take sun's jdk as an example.
Jdk: https://www.oracle.com/downloads/index.html, enter the URL address, and the page appears as below. Then we choose Java SE:
Go to the following page and select the title shown in the red box:
Next jump:
There are various jdk versions. The latest version on the current page is jdk8u66, Which is jdk8 upgraded version 66. We do not recommend the latest version:
1: poor compatibility with the operating system (Windows 8, Windows 10) or IDE
2: unstable, especially during cooperative development, an error is reported when a program developed in a lower version reaches a new version. Therefore, it is not recommended.
We recommend that you use jdk 6 (Development). You can select another jdk version if you want to learn it:
This is a previous version available for learners:
There are so many jdk downloads.
Ii. Install jdk
After the jdk is downloaded, install it.
1: double-click the application to start installation:
As the Installation Wizard goes down,
You can change the installation directory here. Because jdk has been installed on this computer, it is not installed here. After jdk is installed, the system prompts you to install the jre application because
Jdk programs include jre, so the next application does not need to be installed again.
3. Configure Environment Variables
After jdk is installed, you must configure the environment variable:
1. Right-click "computer" and choose "properties" to go to the following page:
2: click "Advanced System settings" to go to the following page:
3: click "environment variables" to configure JAVAHOME, path, and classpath:
4: Meaning of each variable configured
JAVA_HOME: The jdk installation path. My installation directory is F: \ Program Files \ jdk1.6. In this way, you can directly modify JAVA_HOME even if you need to change the jdk path later.
Path and classpath.
Path: % JAVA_HOME % \ bin; % JAVA_HOME % \ jre \ bin; points to the bin directory. In this way, when javac is called to compile the source file or java commands are called to run the bytecode file, first, search for the current directory,
If it cannot be found, it will be searched in the path.
Classpath :.; % JAVA_HOME % \ lib; % JAVA_HOME % \ lib \ tools. jar, pointing to the file path to be run. In fact, this classpath does not need to be configured and will not be affected in future development.