갈루아의 반서재

1. javap 를 이용하는 방법


1
2
3
C:\Program Files\Java\jdk1.8.0_66\bin>javap -verbose login | find "version"
  minor version: 0
  major version: 46
cs

C:\Program Files\Java\jdk1.8.0_66\bin>javap
Usage: javap <options> <classes>
where possible options include:
  -help  --help  -?        Print this usage message
  -version                 Version information
  -v  -verbose             Print additional information
  -l                       Print line number and local variable tables
  -public                  Show only public classes and members
  -protected               Show protected/public classes and members
  -package                 Show package/protected/public classes
                           and members (default)
  -p  -private             Show all classes and members
  -c                       Disassemble the code
  -s                       Print internal type signatures
  -sysinfo                 Show system info (path, size, date, MD5 hash)
                           of class being processed
  -constants               Show final constants
  -classpath <path>        Specify where to find user class files
  -cp <path>               Specify where to find user class files
  -bootclasspath <path>    Override location of bootstrap class files


2. Hex Editor 설치해서 보는 방법

Hex Editor 파일다운로드(https://mh-nexus.de/en/downloads.php?product=HxD) 후 해당 클래스 파일을 열어보면 아래와 같이 minor version = 00 과 major version = 2E 임을 알 수 있다.


16진수 이므로 major version 의 경우 2E 를 십진수로 변환하면 46 임을 알 수 있다.

아래 표에서 보듯이 1.2 버전임을 알 수 있다.


Possible major/minor value :

major  minor Java platform version 
45       3           1.0
45       3           1.1
46       0           1.2
47       0           1.3
48       0           1.4
49       0           1.5
50       0           1.6
51       0           1.7
52       0           1.8

* 자바 클래스 파일의 레이아웃은 아래 링크에서 확인가능하다.

https://en.wikipedia.org/wiki/Java_class_file#General_layout