Runnable JAR file error: Unsupported major.minor version 51.0 - java-7

I made an application in Java (version 7) with Eclipse (Indigo) when I exported my application interface on a Runnable JAR file on my computer and tried it worked fine, then I tried on another computer and I get this problem
Exception in thread "main" java.lang.UnsupportedClassVersionError: cliente/Princ
ipal : 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 java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
der.java:56)
I saw other post that this can be because the other computer have an older version of Java than mine, can somebody confirm this please?.

Yes, that is the error when you try to run Java bytecode with an older version that the version you build it with.
You will find more information in this question.

Related

Does New Relic supports openJDK12?

has been compiled by a more recent version of the Java Runtime (class file version 56.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
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$100(Unknown Source)
at java.net.URLClassLoader$1.run(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 org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:93)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:46)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
PS <path>
Does new relic has different version of jar for openJDK 12 ?
I am running with new relic 5.10.0 version
The Java agent for New Relic supports OpenJDK and AdoptOpenJDK JVM versions 7 to 15 for Linux, Windows, and OS X:
Requirements to install the agent
What happens when you restart the application? Does the error prevent startup or does it recover and continue and begin reporting?

why I am getting java.lang.ClassNotFoundException:com.google.api.client.json.JsonFactory when running on OSGi framework

I am new to OSGi and I made a method which will call the Google translate API. When I called that method in a main it is working fine. And also I used Eclipse for coding and exported the project into a jar file from Eclipse and installed it on the apache felix framework. When I start the bundle I get the following exceptions,
I added all the external jar files to build path also.
org.osgi.framework.BundleException: Activator start error in bundle EnglishToSinhalaServicePublisher [58].
at org.apache.felix.framework.Felix.activateBundle(Felix.java:2452)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2308)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
at org.apache.felix.gogo.command.Basic.start(Basic.java:739)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:139)
at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:91)
at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599)
at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526)
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415)
at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416)
at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229)
at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: com/google/api/client/json/JsonFactory
at englishtosinhalaservicepublisher.Activator.start(Activator.java:46)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:698)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:2402)
... 19 more
Caused by: java.lang.ClassNotFoundException: com.google.api.client.json.JsonFactory not found by EnglishToSinhalaServicePublisher [58]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1597)
at org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:79)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1982)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 22 more
java.lang.NoClassDefFoundError: com/google/api/client/json/JsonFactory
g!

Tomcat 7 : Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file

I have installed tomcat7 in my windows xp pc and on starting the service, i cannot access localhost:8080 in my browser and found the following in tomcat7 log files.
2013-05-15 15:00:30 Commons Daemon procrun stderr initialized
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number
in class file
at java.lang.ClassLoader.defineClass1(Native Method)
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$100(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)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Tomcat 7 requires a minimum of Java 6. The most likely cause is that you are trying to run Tomcat on Java 5 or earlier.
The alternative is that you have added something to your Tomcat install that has been compiled with a later version of Java that you are running. In this case, get a clean Tomcat install running first and then deal with the class version problem (either by running Tomcat with a later version of Java or by recompiling whatever it is you have added for Java 6 or earlier).

Signing jar created with onejar-maven-plugin throwing stackoverflow exception

I have a jar which is created using onejar-maven-plugin, which is meant to listen to jms messages from tibco and process accordingly. It works fine but when I sign this jar using jarsigner and try to run it, it throws the exception below:
org.apache.commons.logging.LogConfigurationException: java.lang.StackOverflowError (Caused by java.lang.StackOverflowError)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:538)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
at org.springframework.context.support.AbstractApplicationContext.<init>(AbstractApplicationContext.java:160)
at org.springframework.context.support.AbstractRefreshableApplicationContext.<init>(AbstractRefreshableApplicationContext.java:89)
at org.springframework.context.support.AbstractRefreshableConfigApplicationContext.<init>(AbstractRefreshableConfigApplicationContext.java:59)
at org.springframework.context.support.AbstractXmlApplicationContext.<init>(AbstractXmlApplicationContext.java:61)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:136)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at com.adobe.jobcloud.envoy.client.PushToPrereleaseWorker.main(PushToPrereleaseWorker.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.simontuffs.onejar.Boot.run(Boot.java:340)
at com.simontuffs.onejar.Boot.main(Boot.java:166)
Caused by: java.lang.StackOverflowError
at com.simontuffs.onejar.OneJarFile.getJarEntry(OneJarFile.java:43)
at java.util.jar.JarFile.getManEntry(Unknown Source)
at java.util.jar.JarFile.getManifestFromReference(Unknown Source)
at java.util.jar.JarFile.getManifest(Unknown Source)
at java.util.jar.JarFile.maybeInstantiateVerifier(Unknown Source)
at java.util.jar.JarFile.getInputStream(Unknown Source)
at com.simontuffs.onejar.OneJarFile.getJarEntry(OneJarFile.java:50)
at java.util.jar.JarFile.getManEntry(Unknown Source)
at java.util.jar.JarFile.getManifestFromReference(Unknown Source)
at java.util.jar.JarFile.getManifest(Unknown Source)
at java.util.jar.JarFile.maybeInstantiateVerifier(Unknown Source)
at java.util.jar.JarFile.getInputStream(Unknown Source)
at com.simontuffs.onejar.OneJarFile.getJarEntry(OneJarFile.java:50)
at java.util.jar.JarFile.getManEntry(Unknown Source)
at java.util.jar.JarFile.getManifestFromReference(Unknown Source)
at java.util.jar.JarFile.getManifest(Unknown Source)
Also if I use maven-jarsigner-plugin to sign it, the result is exactly same. I'm clueless and stuck up with this issue.
Any help will be appreciated.
Have you tried to increase the -Xss JVM option? To 4096k at first, then lower it until it fails again.
Working with ciphers generally maybe need more than default stack size.
For the maven jarsigner plugin you can edit .mavenrc file in your linux home directory and add these lines:
#!/bin/bash
export JAVA_HOME=/usr/lib/jvm/java-6-sun-i586 #(or another)
export M2_HOME=/usr/local/lib/apache-maven/apache-maven-3.0.4
export MAVEN_OPTS="-Xss4096k -XX:MaxPermSize=128m -Xmx384m"
I don't know how to do this under windows, but there must be similar solution (here?)

Maven infinispan quickstart

I compiled Infinispan quickstart and when I am trying to run I am getting following error
Exception in thread "main" java.lang.NoClassDefFoundError: Quickstart (wrong nam
e: org/infinispan/quickstart/embeddedcache/Quickstart)
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: Quickstart. Program will exit.
I am following this tutorial.
https://github.com/infinispan/infinispan-quickstart/tree/master/embedded-cache
Though I am not using any IDE so that I can learn how maven works with infinispan. From command prompt prompt I am using this command To compile,
mvn clean compile dependency:copy-dependencies -DstripVersion
and then, to run,
java -cp target/classes:target/dependency/* Quickstart
It is compiling successfully.
I have tried to compile and then run the quickstart from within target directory where the class file is kept. But I am getting the same error class found .....
Thanks
Meena
Anyhelp will be appreciated.
Try running with
java -cp target/classes:target/dependency/* org.infinispan.quickstart.embeddedcache.Quickstart

Resources