Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

UnsupportedClassVersionError When Running JNI

4bcea905-b96e-45f1-8b35-e2e687f0baceJun 19 2015 — edited Jul 7 2015

Hello All,

I'm getting a UnsupportedClassVersionError error when calling FindClass() when running my C++ application on RedHat Linux.  We're a C++ shop and  we're using JNI in order to use a Java library given to us by a third party broker to interface with their systems.

The program had not been recompiled in a couple of years but recently an older C++ library that the program used was deprecated so we had to recompile this program.  But now when we try to run the program we're getting this error.

Exception in thread "main" java.lang.UnsupportedClassVersionError: TradingEngineWrapper : Unsupported major.minor version 52.0

        at java.lang.ClassLoader.defineClass1(Native Method)

        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)

        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)

        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)

        at java.net.URLClassLoader.access$000(URLClassLoader.java:56)

        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)

        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)

        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

I tried upgrading to a newer version of the JDK (jdk1.8.0_45) but that didn't help.  I know this is caused because our Java class library is compiled with one version but the JRE that is being invoked by the JNI is an incompatible version.  My question is, how do I control what version of the JRE that gets called when starting my C++ application?  Because I'm calling a C++ application I'm not starting it with "java app_name" or anything like that.  Any help would be appreciated.

Thank you.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 4 2015
Added on Jun 19 2015
1 comment
929 views