Posts

Showing posts from 2012

How to check Java version on compiled class

Recently working with Java and encountered some issue regarding java version when I run my java program. Its said that the version of my program is incompatible and it is expecting some version else. After some searching, here is one of my finding on how to check the java version for a compiled class. 1) First start your command prompt. 2) For those who don't have the javap class path matched, navigate into bin folder inside your Java folder. The command is as simple as below: javap -verbose MyClass (MyClass is my class file name) This might output a junk of coding which is not required in this case. The java class can be determined in the early stage. So output everything into a file,  javap -verbose MyClass > myclass.log And now open the the myclass.log and you can see the following at the start. public class MyClass extends java.lang.Object SourceFile: "MyClass.java" minor version: 0 major version: 50 Constant pool: const #1 = clas