Some times we need to identify what compiler version and vendor was used for a given Java class file. We can use Jakarta BCEL to idenfiy compiler version.
Sample Java Code
import org.apache.bcel.classfile.*;
public class JDKIdentifier
{
public static void main(String[] args) throws Exception
{
printClassVersion("c:\\foo.jar", "com/foo/Bar.class");
}
public static void printClassVersion(String jarfile, String classfile) throws Exception
{
ClassParser cp = new ClassParser(jarfile, classfile);
JavaClass clazz1 = cp.parse();
System.out.println(jarfile);
System.out.println("Major: " + clazz1.getMajor());
System.out.println("Minor: " + clazz1.getMinor());
}
}
Reference
http://forum.java.sun.com/thread.jspa?threadID=577007&messageID=3791497
Welcome to Java Junction. Java junction talks about latest Java & related Web Technology.
Subscribe to:
Post Comments (Atom)
ORM Framework for Kotlin
In Kotlin, ORM (Object-Relational Mapping) libraries provide a convenient way to interact with databases using object-oriented programming p...
-
Feature Comparison Feature Liferay(5.1+) JBoss Portal(2.7) Out of the box Tools Has rich set of out of the box portlets Not too muc...
-
OSGi technology is Universal Middleware. OSGi technology provides a service-oriented, component-based environment for developers and offers...
No comments:
Post a Comment