异常信息如下:
C:UsersAdministrator>java -jar -Xmx2000m D:/ha456.jar F:/20160419_1048.dump Exception in thread "main" java.lang.UnsupportedClassVersionError: com/ibm/jinwoo/heap/HeapAnalyzer : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) Could not find the main class: com.ibm.jinwoo.heap.HeapAnalyzer. Program will exit.
网上搜罗发现是jdk版本不兼容,如果是jdk7编译生成的class,使用jdk6以下版本运行就会报Unsupported major.minor version 51.0异常
因此,解决办法为使用jdk7或者jdk8运行ha456.jar
参考资料:
Unsupported major.minor version 51.0问题及解决方法
http://nmskate.iteye.com/blog/1839631/