Java installation and installation of JDK and JRE (easy to understand)

Source: Internet
Author: User
Tags wrapper

Easily understand what a JDK is and what is a JDK?

JDK is the first step to learning Java. Whether you want to learn Java programming, or build a JSP web development environment, or the Android development environment can not do without it.

What is a JDK? The JDK is the abbreviation for Java Development Kit, which means a toolkit developed by Java programs . It can also be said that the JDK is the Java SDK.

First of all, the JDK version, a total of three, the Standard Edition, Enterprise Edition, mobile device version.

First we go to the official website to view

The first download is as follows:

Website address: https://www.oracle.com

or Baidu Download:

Step one: When we are not on the homepage, you can click Oracle to go to the homepage

Step two: Download this trials and downloads is meant to be tested and downloaded

Step three: Go to find JDK in Java

Fourth step: Find

Fifth Step into the download:

Download Completesecond to install:

Here are the installation tips, just the next step

After completing the CMD query Win+r key to run (win key in the middle of CTRL and ALT)

Enter Java return after CMD entry

There will be a lot of things after execution, such as

This indicates that the installation is complete

Delete operation

If installed, you can uninstall it inside the system.

You need to uninstall two:

Delete to complete before installation can be;

to configure the environment:

First step: My Computer Right click on the properties

Step Two: Environment variables, advanced system settings

The following are for systems that do not have an environment variable configured: 1. Add after path edit: %java_home%\bin;%java_home%\jre\bin (Note!!!) If not at the back of the join;)First we need to find the first format of path-> edit (some systems may have two formats):

The second format: (two formats are similar, can be configured according to the system)%java_home%\bin%java_home%\jre\bin

2, to create a new classpathvariable name:CLASSPATH Variable Value:.; %java_home%\lib;%java_home%\lib\tools.jar

3, the new Java_homevariable name: Java_homevariable value is not the same, according to you according to the time to view (recommended click Browse Directory, and then enter the computer system disk [Generally C disk], enter after the program files this file, into the Java file, select the JDK folder can be)You can also go directly to the system disk to find the JDK copy path and put it in the variable value .

My root directory is as follows:

C:\Program files\java\jdk-10.0.2

Final test: Go to cmd command input Javac

This message appears stating that the success prompt has been configured: Eclipse appears with an error have occurred.see the Loh file

Some problems occur after installation

is not the eclipse version is caused by the new, I have the update after the problem has occurred,
Workaround:
1. Open the Eclipse.ini file under the Eclipse installation directory;
2, open the text file last add a row
--add-modules=all-system
3, save reopen Eclipse.

The test was OK. What is a JRE?

Ordinary users do not need to install the JDK to run Java programs, but only install the JRE (Java Runtime Environment). The program developer must install the JDK to compile and debug the program.

Summary:

Simply put, the JDK is a developer-oriented SDK that provides a Java development environment and a running environment. The SDK is software Development Kit generally refers to a software development package, which can include function libraries, compiler programs, and so on.
JDK is Java development Kit
The JRE is Java runtime enviroment, which refers to the Java Runtime Environment, and is intended for users of Java programs, not developers.

If the JDK is installed, there will be two sets of JRE on your computer, one in the \jre and one in the C:\Program files\java\j2re1.4.1_01 directory, and the other Java virtual machine, which is less server-side than the previous set. But just copy the server-side Java Virtual machine in front of you. You can also choose whether to install the JRE located in the C:\Program files\jav a directory when installing the JDK. If you install only the JRE, not the JDK, only a single set of JRE will be installed in the C:\Program Files\java directory.

The JRE is like a PC, and our WIN32 application requires the operating system to run it, and the Java program we write must also have the JRE to run. So when you're finished installing the JDK, if you have two sets of JRE installed in two different places on your hard drive, you can imagine your computer has two virtual Java PCs, all with the ability to run Java programs. So we can say that if you have a JRE installed on your computer, you can run the JAV a application correctly.

1. Why does Sun want to have the JDK install two identical JRE? This is because the JDK has a lot of Java-written development tools (such as Javac.exe, Jar.exe, etc.), and is placed in the \lib\tools.jar. As can be seen from the following example, first renamed Tools.jar to Tools1.jar, and then run Javac.exe, showing the following result: Exception in thread "main" Java.lang.NoClassDefFoundError: Com/sun/tools/javac/main This means that your input javac.exe is the same as the input JAVA-CP C:\jdk\lib\tools.jar Com.sun.tools.javac.Main and will get the same result. From here we can prove that Javac.exe is just a wrapper (Wrapper), and the purpose of the production is to keep the developer from entering too long a finger. And can find the \lib directory of the program is very small, not more than 2 9K, from here we can draw a conclusion. Is that the tool in the JDK is almost written in Java, so it is also a Java application, so to use the tools attached to the JDK to develop Java programs, you must also attach a set of JRE, so it is located in C:\Program files\ The JRE in the Java directory is used to run generic Java programs.

2, if a computer installed more than two sets of JRE, who will decide? The big task falls on Java.exe. Java.exe's job is to find the right JRE to run Java programs. Java.exe the JRE according to the following order: There is no JRE in its own directory; the parent directory has no JRE; query registry: [Hkey_local_machine\software\javasoft\java Runtime Environment] So Java.exe's running results have a lot to do with which JRE in your computer is being executed.

3. The bin directory under the JVM JRE directory has two directories: server and client. This is where the real jvm.dll lies. Jvm.dll cannot work alone, and when Jvm.dll is started, it uses the explicit method (that is, using LoadLibrary () and GetProcAddress () in the Win32 API to load the auxiliary dynamic-link library). These auxiliary dynamic link libraries (. dll) must be in the parent directory of the directory where the Jvm.dll resides. So which JVM you want to use, just set path and point to the Jvm.dll under the directory where the JRE resides.

Java installation and installation of JDK and JRE (easy to understand)

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.