Java JDK, SDK, SE?

后端 未结 4 1156
情话喂你
情话喂你 2021-01-29 22:33

If you could answer these questions or help me out a little with clarity, it will be greatly appreciated:


  • Is Java 7 just Java SE 7? and Java 6 is Java SE 6?
4条回答
  •  醉话见心
    2021-01-29 22:53

    Yes, it can be confusing.

    You didn't ask for it, but I'll start from here. The JVM is the Java Virtual Machine. It is a program that can read compiled Java code (the .class files, and the .jar files that are simply .zip files containing a bunch of .class files packaged together) and execute it. There are many JVMs, for example you need a JVM for Windows, one for Linux, one for OSX etc. but there are also many alternative JVMs, JVMs for embedded device etc. (many will disagree and say that the JVM is only one, and it's a specification. However, commonly a sysadmin will say "the JVM" to indicate the actual binary running on the server).

    You didn't ask for the following either. The JRE is the Java Runtime Environment. It includes everything needed to run a Java application, that is the JVM itself, the standard library and a bunch of other files. The standard library is itself very important, because it contains a lot of useful things you'll use when developing Java applications. It contains all the stuff in java.* packages and some private stuff in com.sun, com.oracle packages.

    Different versions of Java (1.0, 1.1, etc. all the way to 1.7, also known as Java 7) usually contain improvements to both the JVM and the standard library, so the two usually need to run together, and are packaged together in the JRE.

    If you are running any Java program on your computer, you have a JRE installed.

    The JDK is the Java Development Kit. It contains the JRE as well as a lot of other useful stuff for developing Java applications. That includes the compiler obviously (which is also contained in the JRE for some good reason, but you can ignore this fact now), the JAR utility to create .jar files, many tools for "decompiling" class files, inspect .jar files, repackage them, etc.

    It also usually contains documentation for the standard library and also all the sources of the standard library, because they are useful for developers to read and inspect. If you want to seriously develop Java applications, you need the JDK.

    When talking about JavaSE, JavaEE, JavaME etc. those are so called "editions". Basically, since the Java ecosystem is huge, Sun decided to offer Java in different editions:

    • JavaSE: is the standard edition, it is usually a good fit for client side software, normal applications, etc.
    • JavaME: is the mobile edition, it is what small games on old phones was made with, but it's basically a "smaller" version of Java suitable for very low capacity processors.
    • JavaEE: is the "enterprise edition". It is used to develop server side stuff, so it includes a lot of libraries used on server side.

    Regarding numbering, they messed it up quite a bit. Actually, after Java 1.4 they created the JCP, to involve the community in the development of Java itself, and starting from Java 1.5 it is officially named "Java 5", despite most in the industry calling it 1.5. Also, Java 1.2 was Java 2, but everyone I know who was not working in Sun at that time always called it 1.2.

提交回复
热议问题