I have some problem with my java application, I did build it with Eclipse under Win7 (64bit): it does not work on Snow Leopard 10.6.8. The error is: "The JAR file .... could not be launched".
I have checked if Java was installed on Mac and yes, there is JRE with the 64 bit option first to execute.
My Application does not make use of any particular library:
import java.net.*;
import java.io.IOException;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
.. so I really can’t understand why it doesn’t work on Mac, any suggestion? Many thanks for your help
UPDATE:
Yes, it works on Windows, I use Java 6 and unfortunately I don’t have OS X, I’ve sent my application to a friend who has OS X, so I can’t open the Terminal (and my friend never opened it probably…). Thanks for your suggestions anyway.
UPDATE2:This is the output message
13/03/12 19.09.30 [0x0-0x2d52d5].com.apple.JarLauncher[44675] Exception
in thread "main"
13/03/12 19.09.30 [0x0-0x2d52d5].com.apple.JarLauncher[44675] java.lang.UnsupportedClassVersionError:
Main : Unsupported major.minor version 51.0
13/03/12 19.09.30 [0x0-0x2d52d5].com.apple.JarLauncher[44675] at
java.lang.ClassLoader.defineClass1(Native Method)
13/03/12 19.09.30 [0x0-0x2d52d5].com.apple.JarLauncher[44675] at
java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
13/03/12 19.09.30 [0x0-0x2d52d5].com.apple.JarLauncher[44675] at
java.lang.ClassLoader.defineClass(ClassLoader.java:615)
13/03/12 19.09.30 [0x0-0x2d52d5].com.apple.JarLauncher[44675] at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
13/03/12 19.09.30 [0x0-0x2d52d5].com.apple.JarLauncher[44675] at
java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
13/03/12 19.09.30 [0x0-0x2d52d5].com.apple.JarLauncher[44675] at
java.net.URLClassLoader.access$000(URLClassLoader.java:58)
13/03/12 19.09.30 [0x0-0x2d52d5].com.apple.JarLauncher[44675] at
java.net.URLClassLoader$1.run(URLClassLoader.java:197)
13/03/12 19.09.30 [0x0-0x2d52d5].com.apple.JarLauncher[44675] at
java.security.AccessController.doPrivileged(Native Method)
13/03/12 19.09.30 [0x0-0x2d52d5].com.apple.JarLauncher[44675] at
java.net.URLClassLoader.findClass(URLClassLoader.java:190)
13/03/12 19.09.30 [0x0-0x2d52d5].com.apple.JarLauncher[44675] at
java.lang.ClassLoader.loadClass(ClassLoader.java:306)
13/03/12 19.09.30 [0x0-0x2d52d5].com.apple.JarLauncher[44675] at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
13/03/12 19.09.30 [0x0-0x2d52d5].com.apple.JarLauncher[44675] at
java.lang.ClassLoader.loadClass(ClassLoader.java:247)
First of all I made sure I had the same JRE, and apparently mine was the JRE7, so in Eclipse I changed it. Also I did modify the Run/Debugging Configurations: in Environment -> Add new variable DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib
Which should help the execution on OsX. Finally I exported everything again to JAR and it worked on Mac as well.
Thanks for your collaboration.
I hope this answer could help somebody else…