0

I need to add more logs to several classes of specific java module (module is compiled, no sources available). I have successfully extracted sources, but i am confused on which JDK version is to be used to re-compile modified classes.

javap -verbose className.class

shows

...
major version: 46
...

Doesn't 46 version mean that initially class were compiled with JDK 1.2 But source file contains imports from java nio:

import java.nio.ByteBuffer;

which was implemented in the java 5 The question is: How its can be?

Notes:
+ the whole systems running under open-jdk 1.5
+ date of creation module ~2006 year

TreeStan
  • 1
  • 1

1 Answers1

1

The compiler generates class files compatible withh older versions when you use the -target command line switch.

The files you have were probably compiled with -source 1.2 target 1.2. The compatibility only affects what bytecode instructions are used, it doesn't stop you from using newer APIs.

Joni
  • 108,737
  • 14
  • 143
  • 193
  • Joni, so actualy itl means that sources where compiled for e.x. under JDK 1.5 and set compatibility level for 1.2? – TreeStan Jun 25 '13 at 08:08