2012년 7월 7일 토요일

Java: Unsupported major.minor version x.x


I got an error when run the a program related to vmware 5 on eclipse.
This happened after I added vmware api into my project. 

java.lang.UnsupportedClassVersionError: com/vmware/vim25/ManagedObjectReference : Unsupported major.minor version 51.0
       at java.lang.ClassLoader.defineClass1( Native Method)
       at java.lang.ClassLoader.defineClassCond( ClassLoader.java:631)
       at java.lang.ClassLoader.defineClass( ClassLoader.java:615)
       at java.security.SecureClassLoader.defineClass( SecureClassLoader.java:141)
       at java.net.URLClassLoader.defineClass( URLClassLoader.java:283)
       at java.net.URLClassLoader.access$000( URLClassLoader.java:58)
       at java.net.URLClassLoader$1.run( URLClassLoader.java:197)
       at java.security.AccessController.doPrivileged( Native Method)
       at java.net.URLClassLoader.findClass( URLClassLoader.java:190)
       at java.lang.ClassLoader.loadClass( ClassLoader.java:306)
       at sun.misc.Launcher$AppClassLoader.loadClass( Launcher.java:301)
       at java.lang.ClassLoader.loadClass( ClassLoader.java:247)
       at GetCurrentTime.( GetCurrentTime.java:60)
Exception in thread "main" 


It was nothing to do with vmware api itself.


The reason was that I installed two kind of JDKs. The one was 1.7 and the other was 1.6.  I downloaded vmware web service API and build it with JDK 1.7 to make "vim25.jar" and I forgot this. But, on the other hand, my eclipse environment was set with JDK 1.6. 


It was lower version so didn't work with that API which was built with higher one. Again, I built the api with 1.6, it finally worked well.

댓글 없음:

댓글 쓰기