last update : september 2010
If the JAVA versions for development and deployment are different, there is a risk to get the following errors:
- java.lang.ClassFormatError: ClassName (unrecognized class file version)
- Exception in thread “main” java.lang.UnsupportedClassVersionError: Bad version number in .class file
- java.lang.UnsupportedClassVersionError: (Unsupported major.minor version 49.0)
Java has been developed by Sun Microsystems and released in 1995 as a core component of Sun Microsystems’ Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities. Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of computer architecture. As of May 2007, in compliance with the specifications of the Java Community Process, Sun made available most of their Java technologies as free software under the GNU General Public License. More details can be found on Wikipedia.
Sun distinguishes between its Software Development Kit (SDK) and Runtime Environment (JRE) (a subset of the SDK); the primary distinction involves the JRE’s lack of the compiler, utility programs, and header files.
The initial version of JAVA was published as JDK 1.0 on 23 january 1996 with the codename OAK.
JDK 1.1. was launched on february 19, 1997 with new features.
Version 1.2. was published on december 8, 1998 with the codename Playground. This and subsequent releases were rebranded Java 2 with the distinctions J2SE (Java 2 Platform, Standard Edition), J2EE (Java 2 Platform, Enterprise Edition) and J2ME (Java 2 Platform, Micro Edition).
J2SE 1.3. was released on may 8, 2000 as Kestrel and included JAVA Sound.
J2SE 1.4. was published on february 6, 2002 with the codename Merlin and included Java Web Start, 18 updates have been released for this version.
Originally numbered 1.5, the Java version released on september 30, 2004, called Tiger, was named J2SE 5. 17 updates have been released for this version.
The latest Java Version, SE 6, (codename Mustang) was published on december 11, 2006. As of this version, Sun replaced the name “J2SE” with Java SE and dropped the “.0” from the version number. The current update is version 12.
Java SE 7 with the codename Dolphin is in the early planning and development stages and is tentatively scheduled for release in 2010.
The Java Business Support road map is available at the Sun website.
The Java Class File Disassembler javap gives the version of a compiled Java class. The major version number correspondance is indicated in the following table :
45 :arrow: Java 1.0 / 1.1
46 :arrow: Java 1.2
47 :arrow: Java 1.3
48 :arrow: Java 1.4
49 :arrow: Java 5.0
50 :arrow: Java 6
Another possibility to identify the java version is to inspect the class file with an Hex-editor. The major version number is stored in the 6th and 7th byte of the file.
To show the installed java version on a server, the following code can be used :
String maxVersion = System.getProperty(“java.class.version”)
An example of a servlet displaying the java version of my hosted Tomcat server is linked here.
Here is a link to show whether Java is working on your computer and to display the installed Java version.