in JAVA

JAVA > How to check the byte code class version.

ref

On Linux, Mac OS X or Windows with Cygwin installed, the file(1) command knows the class version. Extract a class from a jar and use file to identify it:

리눅스나 맥에서는 간단하게 아래와 입력하시면 됩니다. Window의 경우 Cygwin이라는 툴이 별도로 필요하며 사용방법은 아래와 같습니다.

$ jar xf log4j-1.2.15.jar
$ file ./org/apache/log4j/Appender.class
./org/apache/log4j/Appender.class: compiled Java class data, version 45.3
A different class version, for example:

$ file ~/bin/classes/P.class
/home/dave/bin/classes/P.class: compiled Java class data, version 50.0

The class version major number corresponds to the following Java JDK versions:

클래스 버전에서 나온 수치는 아래와 같이 매칭됩니다.

  • 46 = Java 1.2
  • 47 = Java 1.3
  • 48 = Java 1.4
  • 49 = Java 5
  • 50 = Java 6
  • 51 = Java 7

Write a Comment

Comment

  • Related Content by Tag