Search code examples
javamacososx-snow-leopard

Java based mac app is not working in old MacOSX


I have developed a Java-based app and create a desktop mac app. As you know, when you create a bundle for Mac you have to embed the complete JDK (in my case 1.8) in the bundle, so it does not matter if the target has or hasn't Java installed, your app comes with it.

Everything is working fine in MacOSX 10.10 and 10.9 ... (I have not tested in 10.7 or 10.8).

But when I run in a 10.6.8 MacOSX Java crashes ... in the console I see this:

Process:         JavaAppLauncher [354]
Path:            /Applications/myapp.app/Contents/MacOS/JavaAppLauncher
Identifier:      com.myapp.desktop
Version:         1.0.8 (1)
Code Type:       X86-64 (Native)
Parent Process:  launchd [130]

Date/Time:       2015-02-27 16:58:14.384 +0100
OS Version:      Mac OS X 10.6.8 (10K549)
Report Version:  6

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000
Crashed Thread:  3

Thread 0:  Dispatch queue: com.apple.main-thread
0   libSystem.B.dylib               0x00007fff8a4acd7a mach_msg_trap + 10
1   libSystem.B.dylib               0x00007fff8a4ad3ed mach_msg + 59
2   com.apple.CoreFoundation        0x00007fff848a2902 __CFRunLoopRun + 1698
3   com.apple.CoreFoundation        0x00007fff848a1d8f CFRunLoopRunSpecific + 575
4   libjli.dylib                    0x0000000100038b34 CreateExecutionEnvironment + 871
5   libjli.dylib                    0x0000000100034ac4 JLI_Launch + 1952
6   com.myapp.desktop          0x00000001d7448990 launch + 5696
7   com.myapp.desktop          0x00000001d7447136 main + 102
8   com.myapp.desktop          0x00000001d74470c4 start + 52

Thread 1:  Dispatch queue: com.apple.libdispatch-manager
0   libSystem.B.dylib               0x00007fff8a4c5c0a kevent + 10
1   libSystem.B.dylib               0x00007fff8a4c7add _dispatch_mgr_invoke + 154
2   libSystem.B.dylib               0x00007fff8a4c77b4 _dispatch_queue_invoke + 185
3   libSystem.B.dylib               0x00007fff8a4c72de _dispatch_worker_thread2 + 252
4   libSystem.B.dylib               0x00007fff8a4c6c08 _pthread_wqthread + 353
5   libSystem.B.dylib               0x00007fff8a4c6aa5 start_wqthread + 13

Thread 2:
0   libSystem.B.dylib               0x00007fff8a4e7a6a __semwait_signal + 10
1   libSystem.B.dylib               0x00007fff8a50e896 pthread_join + 844
2   libjli.dylib                    0x0000000100038134 ContinueInNewThread0 + 102
3   libjli.dylib                    0x0000000100035738 ContinueInNewThread + 201
4   libjli.dylib                    0x0000000100037f09 JVMInit + 315
5   libjli.dylib                    0x00000001000354b6 JLI_Launch + 4498
6   com.myapp.desktop          0x00000001d7448990 launch + 5696
7   com.myapp.desktop          0x00000001d7447136 main + 102
8   libjli.dylib                    0x00000001000387c6 apple_main + 92
9   libSystem.B.dylib               0x00007fff8a4e5fd6 _pthread_start + 331
10  libSystem.B.dylib               0x00007fff8a4e5e89 thread_start + 13

Thread 3 Crashed:
0   com.apple.CoreFoundation        0x00007fff848d98a1 ___forwarding___ + 673
1   com.apple.CoreFoundation        0x00007fff848d5a38 _CF_forwarding_prep_0 + 232
2   libobjc.A.dylib                 0x00007fff89347325 _class_initialize + 384
3   libobjc.A.dylib                 0x00007fff8935552b prepareForMethodLookup + 234
4   libobjc.A.dylib                 0x00007fff8934dcb9 lookUpMethod + 73
5   libobjc.A.dylib                 0x00007fff89345faa objc_msgSend + 198
6   libawt_lwawt.dylib              0x0000000116528ca4 JNI_OnLoad + 412
7   libjava.dylib                   0x00000001004c7c49 Java_java_lang_ClassLoader_00024NativeLibrary_load + 208
8   ???                             0x00000001027474d4 0 + 4336153812
9   ???                             0x000000010273b98d 0 + 4336105869
10  ???                             0x000000010273b160 0 + 4336103776
11  ???                             0x000000010273b98d 0 + 4336105869
12  ???                             0x000000010273b98d 0 + 4336105869
13  ???                             0x00000001027344e7 0 + 4336076007
14  libjvm.dylib                    0x0000000101ad4442 JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*) + 1710
15  libjvm.dylib                    0x0000000101b094bb jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*) + 447
16  libjvm.dylib                    0x0000000101b027ed jni_CallStaticVoidMethodV + 232
17  libjava.dylib                   0x00000001004d49cb JNU_CallStaticMethodByName + 282
18  libawt.dylib                    0x00000001163bb337 AWT_OnLoad + 547
19  libawt.dylib                    0x00000001163bb384 JNI_OnLoad + 9
20  libjava.dylib                   0x00000001004c7c49 Java_java_lang_ClassLoader_00024NativeLibrary_load + 208
21  ???                             0x00000001027474d4 0 + 4336153812
22  ???                             0x000000010273b98d 0 + 4336105869
23  ???                             0x000000010273b160 0 + 4336103776
24  ???                             0x000000010273b98d 0 + 4336105869
25  ???                             0x000000010273b98d 0 + 4336105869
26  ???                             0x000000010273b98d 0 + 4336105869
27  ???                             0x000000010273b710 0 + 4336105232
28  ???                             0x00000001027344e7 0 + 4336076007
29  libjvm.dylib                    0x0000000101ad4442 JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*) + 1710
30  libjvm.dylib                    0x0000000101b2ade2 JVM_DoPrivileged + 1208
31  ???                             0x00000001027474d4 0 + 4336153812
32  ???                             0x000000010273b710 0 + 4336105232
33  ???                             0x000000010273b98d 0 + 4336105869
34  ???                             0x00000001027344e7 0 + 4336076007
35  libjvm.dylib                    0x0000000101ad4442 JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*) + 1710
36  libjvm.dylib                    0x0000000101aa92b5 InstanceKlass::call_class_initializer_impl(instanceKlassHandle, Thread*) + 191
37  libjvm.dylib                    0x0000000101aaa797 InstanceKlass::initialize_impl(instanceKlassHandle, Thread*) + 1479
38  libjvm.dylib                    0x0000000101aaaa19 InstanceKlass::initialize(Thread*) + 61
39  libjvm.dylib                    0x0000000101ba674a LinkResolver::resolve_static_call(CallInfo&, KlassHandle&, Symbol*, Symbol*, KlassHandle, bool, bool, Thread*) + 156
40  libjvm.dylib                    0x0000000101ba695e LinkResolver::resolve_invokestatic(CallInfo&, constantPoolHandle, int, Thread*) + 258
41  libjvm.dylib                    0x0000000101ba6a1f LinkResolver::resolve_invoke(CallInfo&, Handle, constantPoolHandle, int, Bytecodes::Code, Thread*) + 179
42  libjvm.dylib                    0x0000000101ace819 InterpreterRuntime::resolve_invoke(JavaThread*, Bytecodes::Code) + 881
43  ???                             0x00000001027533ba 0 + 4336202682
44  ???                             0x000000010273b98d 0 + 4336105869
45  ???                             0x000000010273b710 0 + 4336105232
46  ???                             0x000000010273b7e4 0 + 4336105444
47  ???                             0x000000010273b710 0 + 4336105232
48  ???                             0x000000010273b98d 0 + 4336105869
49  ???                             0x00000001027344e7 0 + 4336076007
50  libjvm.dylib                    0x0000000101ad4442 JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*) + 1710
51  libjvm.dylib                    0x0000000101b094bb jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*) + 447
52  libjvm.dylib                    0x0000000101b026b5 jni_CallStaticVoidMethod + 349
53  libjli.dylib                    0x00000001000360ea JavaMain + 2456
54  libSystem.B.dylib               0x00007fff8a4e5fd6 _pthread_start + 331
55  libSystem.B.dylib               0x00007fff8a4e5e89 thread_start + 13

Any ideas ?


Solution

  • JRE/JDK 8 requires OS X 10.8 (Mountain Lion) or higher. http://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jre.html#A1098497

    JRE/JDK 7 requires OS X 10.7 (Lion) or higher. http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jre.html#requirements

    What I normally do is create a second version of the app to target JRE 6, which is system-included (or automatically downloaded when needed) prior to OS X 10.7. I don't target JRE 8, instead just target JRE 7, so you only need to have two versions of the app to cover the vast majority of OS X users.