开发者

JDK, JRE, Java: Version Confusion

(Note: this questions and its answers are from 2011 and show how the world was at that time.)


Although I'm not a real Java developer (yet), I feel like I should know this by now, but I'm still very confused. My question has two parts:

  1. What is the difference between the so-called (as I've seen it) "Sun JDK", OpenJDK, and GCJ?

  2. At various times, I've seen each of the following thrown around, making it very confusing t开发者_JAVA百科o understand which version numbers actually apply to what. Can someone please help me sort this out?

    • Java 6
    • Java 1.6
    • JDK 6
    • JDK 1.6
    • JRE 1.6
    • JVM 11.0

Note: I do understand the difference between the JDK (Java Development Kit) and the Java Runtime Environment. I'm not totally clear on the difference between the JRE and JVM however, although I know what the JVM is/does.


  1. Sun JDK is made by Sun, OpenJDK is a competing open source implementation. GCJ is the GNU java compiler.
  2. Java 6 = Java 1.6 and JDK 6 = JDK 1.6

Details item 1 http://en.wikipedia.org/wiki/OpenJDK https://stackoverflow.com/questions/1977238/why-should-i-use-the-sun-jdk-over-the-openjdk-or-vice-versa

http://en.wikipedia.org/wiki/GNU_Compiler_for_Java

How does the GCJ relate to the Sun JDK/OpenJDK? There is no direct relation that I am aware of. GCJ is a separate project. What are the merits of using one JDK over the other? Licensing issues can occur if you redistribute the Sun JDK. Personally I put more trust in the Sun JDK, because of its stability. Isn't OpenJDK a Sun project? Yes and no. It's a community project.


Java 6 and Java 1.6 are the same. Originally Java was named Java 1.X but as time went, Sun marketing found that it would better signal the significant improvements done if they dropped the "1." part. The first version to do so was Java 1.5 which was marketed as Java 5.

JRE 6 is the consumer distribution of Java 6. It is easy to download from http://java.com.

JDK 6 is the developer distribution of Java 6. It contains tools like a compiler and support for more cultures than the default JRE. It needs to be downloaded from http://javasoft.com.

JVM 11.0 is the version of the Java "interpreter" inside the Oracle JRE/JDK (other vendors use different numbers). This is similar to saying that Windows Vista is really Windows 6.0.6001.


  1. They're basically different implementations of the same set of standards that describe how a Java Virtual Machine should work.
  2. Java versioning progressed in the normal manner from 1.0 to 1.4 when some clever guy from marketing came up with the idea of calling the next version "Java 5" instead of 1.5, but of course this only caused confusion, which carried over to the 6 (1.6) series and will probably continue for some time. I have no idea what JVM 11.0 could be though. (Are you sure it isn't 1.1.0? I know it's a long shot but who knows.)

And the difference between the JVM and the JRE. Strictly speaking the JVM is just the machine that interprets the Java bytecode, while a JRE also contains all the standard class libraries, resource files, dlls (sos) and so on.


Sun over the years have made some changes to the naming conventions for their programming language. Originally you had jdk1.1 and so on. At jdk1.2 they decided to change this to Java 2. So you will see some older books about Java 2.

Then for some mysterious reason it went back to jdk1.3 then jdk1.4. When jdk1.5 was released they made a concious effort to change the names again. So we had Java 5. Since they decided to stick with this you have the following:

   jdk1.5 = Java 5
   jdk1.6 = Java 6
   jdk1.7 = Java 7

and (maybe) so on.

So hopefully that explains that part of it. In your question Java6 == Java 1.6 == JDK 6 == JDK 1.6.

As for JVM vs JRE. The JRE contains the JVM as well as class libraries and any other tools necessary to run your Java program. The JVM is simply the program that interprets your byte code and executes it on the host machine.


Beware, GCJ is not a certified JVM. It is the GNU Classpath for Java project which has partial Java compatability under a GNU license. You should stear clear of it unless you are certain it meets your needs and you have a reason you cannot use another complete Java implementation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜