Jre jdk and the difference (rpm)

Many programmers have done for some time still do not understand the difference between java jdk and jre's.
JDK is the Java Development Kit. Simply put JDK is for developers using the SDK, which provides a Java development environment and runtime environment. SDK is a Software Development Kit generally refers to software development kit may include libraries, compilers and so on.
JRE is a Java Runtime Enviroment refers to the Java runtime environment, Java programs are facing the user, not the developer.
If the JDK is installed, your computer will be issued with two sets of JRE, located in a \ jre another set located in C: \ Program Files \ under Java \ jre1.5.0_15 directory, set back less than the previous set of Server side Java virtual machine, but a direct copy of the previous set of Server-side Java virtual machine came on the line. But also in the installation you can choose whether to install the JDK is located in C: \ JRE under Program Files \ Java directory. If you only install the JRE, not the JDK, then only in C: install a unique set of JRE \ Program Files under \ Java directory.
JRE status as a PC, we write Win32 applications require the operating system to help us run the same, Java programs must also be written in our JRE to run. So when you finished loading JDK, if separately in two different places on the hard disk to install two sets of JRE, then you can imagine your computer has two virtual machine of Java PC, have a function to run Java programs. So we can say, as long as your computer to install the JRE, Java applications can be run properly.
1, Why let the Sun JDK JRE installed two sets of the same?
This is because there are a lot JDK written in Java development tools (such as javac.exe, jar.exe, etc.), and are placed in the \ lib \ tools.jar years. As can be seen from the example below, the first tools.jar renamed tools1.jar, and then run the javac.exe, show the following results: Exception in thread "main" java.lang.NoClassDefFoundError : com / sun / tools / javac / Main this meaning that you enter javac.exe input java -cp c: \ jdk \ lib \ tools.jar com.sun.tools.javac.Main is the same, will get the same results. From here we can prove javac.exe just a wrapper (Wrapper), while making purpose is to allow developers from having to enter long fingers life. And you can find \ lib directory of the program are small, not more than 2 9K, from here we can draw a conclusion. Is the JDK tools is almost written in Java, it is also a Java application, so use JDK accompanying tools to develop Java programs, must also attach themselves to a JRE for the job so located at C: \ Program Files \ the next set of Java JRE directory is used to run Java programs are generally used.
2, if a computer installed more than two sets of JRE, who decides it?
The major task falls java.exe body. Java.exe job is to find a suitable JRE to run Java programs. Java.exe accordance with the order under to find the JRE: there is no JRE own directory; parent directory has no JRE; to query the registry: [HKEY_LOCAL_MACHINE \ SOFTWARE \ JavaSoft \ Java Runtime Environment] Therefore, operating results with your java.exe JRE is inside the computer which has a lot to perform.
ADD :( small summary)
1.JVM - java virtual machineJVM is what we often say that the java virtual machine, it is the entire java achieve cross-platform core part of all the java programming will first be compiled into class files .class, which can be in the class file execution on a virtual machine, that class does not correspond directly with the operating system of the machine, but indirectly through the virtual machine operating system to interact with the virtual machine will perform the procedure explained to the local system. 2.JRE - java runtime environmentJRE refers to the java runtime environment. There can not be light JVM to perform class, as explained in class when JVM need to call the library lib explanation needed. In JDK installation directory where you can find jre directory, there are two folders bin and lib, where you can think of is in the bin jvm, jvm lib is in the library needed for the work, and while jvm lib and up He called jre. So, after you have written java program is compiled into .class, you can put this package together jre .class file and distributed to friends, so your friends can run a program you write. (Jre run .class there's java.exe) 3.JDK - java development kitJDK is java development kit, basically every person will first learn the java machine is equipped with a JDK in, that he which contains several parts of it ? Let's look at the JDK installation directory. In the following six folder directory, a source src library archive, and several other declaration file. Among them, the real work when you run java following four folders: bin, include, lib, jre. Now we can see that such a relationship, JDK includes JRE, and JRE included JVM. bin: the most important is the compiler (javac.exe) include: the header files lib java and interact with the JVM: library jre: java runtime environment (note: bin here, lib and jre folders in the bin, lib is different) is used to develop the whole JDK java program, and run jre is the only class without compiling function.
eclipse, idea and other IDE has its own compiler instead of JDK bin directory that comes with, so when you install you will find that they just ask you to select the jre path ok.

Transfer from: http: //www.cnblogs.com/myitm/archive/2011/05/03/2035942.html

Reproduced in: https: //www.cnblogs.com/JoannaQ/p/3145556.html

Guess you like

Origin blog.csdn.net/weixin_34010949/article/details/93056411