I am using Apache Ignite server in my application with Ignite jars (Ignite jar version 2.12.0) alone and I did not implemented with the Ignite standalone software, since it requires separate software.
The problem is that, when used with Java 8, it is running properly, when used with Java 7, it is showing UnsupportedClassVersionError.
Note: In my application the requirement is Java 7 only.
Error details:
java.lang.UnsupportedClassVersionError: org/apache/ignite/spi/discovery/tcp/ipfinder/TcpDiscoveryIpFinder : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
Could any one guide on that? How to use Apache Ignite with Java 7?
I concur with #Mark Rotteveel. Java 7 is long past its end-of-life, and continuing to develop new code for that platform is a mugs game1, 2.
Upgrade to Java 8. Tell the boss it needs to be done.
However, assuming that you want to keep digging yourself deeper into the Java 7 hole ...
Looking at the Apache Ignite release history, I see that Java 7 support was dropped in Ignite 2.4. So if you were willing and able to roll back to Ignite 2.3 or earlier, there is a good chance you can put off upgrading to Java 8 a bit longer.
Another alternative would be to checkout more a more recent version of Ignite from the official source repository, and see if you can build it for Java 7. (The Java source and target versions are set in the "parent/pom.xml" file ...)
Q: Which post 2.4 version(s) of Ignite will still build for Java 7?
A: I don't know. You may have to modify the code to make it build, especially if they have started using new Java 8+ language features.
Q: Will the built code work?
A: I don't know.
Q: Will the back-ported code be supported by the code authors?
A: Not a chance!
1 - ... unless you or your company are being very well paid for doing this work. In that case, the mugs are your clients.
2 - https://www.merriam-webster.com/dictionary/a%20mug%27s%20game
The minimum supported version is Java 8. I don't think you'll get it working on anything older. Java 7 was released in 2011 and has not been supported for some time.
This is my first application that i try to execute exe.
I'm using launch4j to do this. After executing and trying to run, I get this error:
Blockquote
Launch4j - Exception in thread "main" java.lang.UnsupportedClassVersionError: FakeMain has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
I searched something about versions of java, so I checked my versions of java and they are the same.
That's my versions of java:
My versions of java in cmd
Maybe I did something wrong there?
Screen of Launch4j
I don't know what I can do. I spend all this day about fix this and nothing.
Error after try to run exe file
You have compiled the code with Java 11 as target. But your PC want's to execute the Java Code with Version 8, which is not possible.
Make sure you have installed the correct Versions and also make sure that the executable uses Java 11.
Here you can find the Java Versions mapped to the Runtime Versions: Java Version Numbers
The Article gives you also some information about how to compile and execute for the correct versions.
I am having a bit of trouble determining if I am running the correct version of Eclipse and/or Java. I am attempting to make changes to a JAXB program for work. I can't run the program and an error is generated that states
java.lang.UnsupportedClassVersionError: RunISOPaymentFileSimulator : Unsupported major.minor version 51.0
I know from doing my research using the search function this means that I need version J2SE 7.
After searching for my current version I find that I have Java 6 Standard Edition build 1.6.0.
My question is this: Is Java 6 the same thing as J2SE 6? Do I need to just update my Java version to 7 or do I need to also find the special J2SE 7?
Thanks very much!
Neither Java not J2SE is specific enough. What you need is the Java 7 JRE (Java Runtime Environment.) You probably already have it but your JAVA_HOME is set to 6. Changing your JAVA_HOME can cause issues for some applications that are written poorly so be prepared to have to switch it back.
http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html
My local setup has all java 6 configured. I needed catalina jar file. So I took the latest one -
http://mvnrepository.com/artifact/org.apache.tomcat/tomcat-catalina/8.0.15
but that gave me following errors/warnings
warning: javalangObject.class(javalang:Object.class): major version 51 is newer than 50, the highest major version supported by this compiler.
and build failed.
Only way this was possible is that catalina.jar is compiled with java 7 and my setup is using java6. I confirmed that was the case by using an older version of the library.
http://mvnrepository.com/artifact/org.apache.tomcat/catalina/6.0.35
I would like to know how do we know which library version is compiled with which version of java. Specifically in Maven I don't see any such information.
Major version of 51 means it was compiled with Java 7. Major version 52 means, it was compiled with Java 8. Java 6 has major version 50.
You may extract some class files out of the jar downloaded from Maven. Then check the major version of the class as below:
$ javap -verbose someclass.class | grep -i major
Which will indicate the javac version used for compiling.
I've created a executable jar file in an Windows environment. I'm able to run this jar without any problems in Windows.
When I try and run the same jar in a unix environment, I get the following exceptions:
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(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(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 java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:56)
What am I doing wrong?
You are trying to run it under an earlier version of Java.
You can compile targeting the correct version, or run under a newer version.
Looks like you're building on Java 7 and then trying to run on Java 5, or something like that. It's not a matter of Windows vs Unix - it's a matter of the version of Java within the operating system.
Ideally, upgrade your Unix system to a recent release of Java - or if you can't do that, change how you're building to use the -target flag in javac to generate appropriate bytecode. You should target the right version of the standard libraries for the environment you need to run in, too.
You are trying to run a program compiled on a newer version of Java on an older version of Java.
Make sure the program is compiled for the appropriate target version that you will be running on. You can set compile options to use a newer compiler to create programs that will run on older versions, but obviously you can't use newer features.
For example: Java 7 runs all previous versions of binaries. Java 5 can't run newer versions of binaries.
Make sure you have on both platforms the latest version of Oracle Java installed.
UnsupportedClassVersionError means that you compiled the class with a version of Java that is newer than the version of Java that you are trying to run the program on.
For example, you have compiled this with JDK 6, and you are trying to run the program on a Java 5 or older JVM.
That doesn't work. Newer versions of Java are able to run programs compiled with older versions, but not the other way around.
It's likely that you have an older version of Java on your *nix install as opposed to your Windows install. The jar was built using a newer version, meaning it can't run on the old version because it may have features that aren't supported yet. Try updating your *nix Java and try running it again.
It looks like the .class file was compiled with a newer version of java then your linux installation. please update the results of:
java --version
on both linux and windows, and check if you have java, and not openjdk, on linux (openjdk might bug).
if the version on linux is lower then on windows, that is the problem, update it.
Most likely you are trying to execute a jar file compiled with a compiler with a newer version than the JVM installed on the system where you are trying to execute it. Check JVM version on the Linux system and make sure to have a version equal or newer than the version of the compiler ...
(Posted on behalf of the question author).
Thanks for the help, it seems you all are correct. I developed the jar on java 1.6 and our unix server is on 1.5.