0

Possible Duplicate:
unsupported major .minor version 51.0

I am learning java these days.I created an application in it and created an executable Jar file of it. The jar file is working properly in Windows 7 but when i tried to run the same Jar file in Macos then i get the following error:

Exception in thread "main" java.lang.reflect.InvocationTargetException
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.UnsupportedClassVersionError: org/redfire/screen/ScreenShare : 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 java.lang.ClassLoader.loadClass(ClassLoader.java:247)
 at FinalJavaScreenShare.InitialiseScreenShare(FinalJavaScreenShare.java:150)
 at FinalJavaScreenShare.GetServerData(FinalJavaScreenShare.java:134)
 at FinalJavaScreenShare.main(FinalJavaScreenShare.java:46)

What could be the reason for such an error. I want to know whether i have to create separate Jar file for different OS or is there any issue with the current version of the Jar.

Note: I am using Eclipse Helios for the creation of the Jar file.

Please help me .Any help will be appreciated.

Thanks and regards.

Community
  • 1
  • 1
Vipin Nair
  • 517
  • 4
  • 9
  • 33

1 Answers1

0

This has been flagged as a duplicate based on your 1st question (please focus on one question per ..question). I will address the other part of it.

Do I have to create separate Jar file for different OS or is there any issue with the current version of the Jar?

No & yes respectively.

The important thing here is to ensure the cross-compilation options of javac are used to compile code for the minimum Java run-time version that supports it.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433