Is there any way to find out if the class has been compiled for java6?

How should I do to find out if the java class has been compiled for use in java 6 vm?

Is there an easy way?

+5
source share
3 answers

The specification of the class file format . The WP article on this subject includes the current set of version number constants.

+4
source

On unix,

$ javap -classpath <classpath> -verbose foo.Bar \
  | grep -q 'major version: 50' && echo yep || echo nope

thanks @matt b. A.

+4
source
0
source

All Articles