There must be some Java gurus around... help please! Also, stickies? [rant]

Hi all,

I've spent hours upon hours trying to resolve the Java on OS X issue detailed here: Arduino application will not run OSX - Installation & Troubleshooting - Arduino Forum and here: Arduino application will not run OSX - Installation & Troubleshooting - Arduino Forum, to no avail.
I refuse to believe that Arduino forum users are not helpful or that there are no Java/OS X experts here. I firmly believe the issue relates to the poor MB layout and lack of 'sticky' (sub-)subjects. In other words, there must be a way to better organize this forum. Some sticky sub-topics could drastically decrease the time reading information that does not help specific situations. How about a "$OS - related" sub-stickies for OS X, Widows, Linux, etc? How about adding another layer of 'category' organization, so that we can make the forum experience a more pleasant and, most importantly, more efficient one?

[/rant]

Cheers,
Matt

edit: additional URL ref

The java error seen in those threads mentions "java.lang.NoClassDefFoundError: javax/swing/filechooser/FileNameExtensionFilter". I experienced this as well when attempting to upgrade from Arduino 1.0.4 to 1.0.5 on my (old) Mac OS X system: 1.0.5 would not launch, dying immediately with that same error.

I determined that the version of Java on my system did not have an implementation of FileNameExtensionFilter, and my system is too old to support a more recent version of Java. However, the code for FileNameExtensionFilter is available at http://grepcode.com, so I compiled it and added it to java's classes.jar, which solved the problem.

Thanks Kelvin. I tried that, but still no joy. I even downloaded a fresh image of Java install from the Apple website and reinstalled, but the problem persists.

cheers,
Matt

I see (from the crash log that you attached in the other thread) that you have a different problem than the FileNameExtensionFilter one reported by fetalharpoon. I’m not sure what’s going on in your case, but I do note that the crashing Thread 4 is using libjvmlinkage.dylib, libjava.jnilib, and libjvm.dylib. From the memory map, libjvmlinkage.dylib appears to be version 1.6.0, while the other two libraries appear to be version 1.5.0.

   0xec000 -    0xf3ffb  libjvmlinkage.dylib (??? - ???) <6A77EDD1-D1B2-39A9-A637-67BC1D7349F9> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries/libjvmlinkage.dylib
  0x700000 -   0x71dfff  libjava.jnilib (??? - ???) <0B19A099-D54D-3F61-82FA-314783329860> /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries/libjava.jnilib
  0x730000 -   0x738fff  com.apple.java.JavaRuntimeSupport (14.7.0 - 14.7.0) <BE2884EA-32E0-363C-B0C0-809CAB43F86E> /System/Library/Frameworks/JavaVM.framework/Versions/A/Frameworks/JavaRuntimeSupport.framework/Versions/A/JavaRuntimeSupport
 0x3300000 -  0x366dfe3  libjvm.dylib (??? - ???) <E873F28F-C5E1-DAA6-2B07-7C1A50044B06> /System/Library/Java/JavaVirtualMachines/1.5.0/Contents/Home/bundle/Libraries/libjvm.dylib

I don’t know if this is kosher or indicates some misconfiguration in your java install, and I probably can’t be of much help in that area; but I’d like to see what you get if you launch the Terminal and do “ls -l /System/Library/Frameworks/JavaVM.framework/Versions”.

Hi Kelvin,

Here we go:

sh-3.2# ls -l /System/Library/Frameworks/JavaVM.framework/Versions/
total 64
lrwxr-xr-x  1 root  wheel   10 May 30 05:00 1.4 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 May 30 05:00 1.4.2 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 May 30 05:00 1.5 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 May 30 05:00 1.5.0 -> CurrentJDK
drwxr-xr-x  8 root  wheel  272 Aug 29  2012 1.5.0 1
drwxr-xr-x  9 root  wheel  306 Aug 29  2012 1.5.0_30
lrwxr-xr-x  1 root  wheel   10 May 30 05:00 1.6 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 May 30 05:00 1.6.0 -> CurrentJDK
drwxr-xr-x  8 root  wheel  272 May 30 05:00 A
lrwxr-xr-x  1 root  wheel    1 May 30 05:00 Current -> A
lrwxr-xr-x  1 root  wheel   59 May 30 05:00 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents

Additionally,

sh-3.2# locate libjvmlinkage.dylib
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries/libjvmlinkage.dylib
sh-3.2# locate libjvm.dylib
/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/MacOS/itms/java/lib/client/libjvm.dylib
/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/MacOS/itms/java/lib/server/libjvm.dylib
/Developer/Applications/Utilities/Application Loader.app/Contents/MacOS/itms/java/lib/client/libjvm.dylib
/Developer/Applications/Utilities/Application Loader.app/Contents/MacOS/itms/java/lib/server/libjvm.dylib
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Libraries/libjvm.dylib
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Libraries/libjvm.dylib
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries/libjvm.dylib
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Libraries/libjvm.dylib
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Libraries/libjvm.dylib
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries/libjvm.dylib
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Libraries/libjvm.dylib
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Libraries/libjvm.dylib
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries/libjvm.dylib
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Libraries/libjvm.dylib
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries/libjvm.dylib
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/libjvm.dylib
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries/libjvm.dylib
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/server/libjvm.dylib
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0 1/Libraries/libjvm.dylib
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0_30/Libraries/libjvm.dylib
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries/libjvm.dylib
sh-3.2# locate libjava.jnilib
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0 1/Libraries/libjava.jnilib
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0_30/Libraries/libjava.jnilib
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0_30/MacOS/libjava.jnilib
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries/libjava.jnilib
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/MacOS/libjava.jnilib

Thanks for trying to help, I really appreciate it.

Cheers,
Matt

Your problem looks similar to the report at http://code.google.com/p/arduino/issues/detail?id=390, where the suggested workaround is to delve into your Arduino.app, edit the file Arduino.app/Contents/Info.plist, and change:

      <key>JVMVersion</key>
      <string>1.5*</string>

to

      <key>JVMVersion</key>
      <string>1.6*</string>

As for your library versions, there must be one or more symlinks along the path /System/Library/Java/JavaVirtualMachines/1.5.0/Contents/Home/bundle/Libraries/libjvm.dylib, so it’s not clear what version you are actually getting. If the workaround doesn’t fix your problem, it might be worth finding the symlink(s). Looks like the other two libraries are 1.6.0.

Kelvin,

Thank you! That was it, I now have a working 1.5.2 IDE. Yaaay!
I'd love to get you a beer or maybe a shield of your choosing - how do I go about it?

Thanks,
Matt

Glad that solved it!

You're very generous, but no need for a reward beyond the mutual help we all give around here. I've gotten lots of good info on this forum and am happy to have the opportunity to give back.

That's very nice of you and you've made a friend.

Cheers,
Matt

:grin:

edit the file Arduino.app/Contents/Info.plist, and change:

      <key>JVMVersion</key>
      <string>1.5*</string>

to

      <key>JVMVersion</key>
      <string>1.6*</string>

I’ve never edited an OS X application before. What tool should I use to make this change?

Gary

You can just use TextEdit, or any other application that edits text files.

Control-click (or right-click) on the Arduino application, and in the pop-up menu that results, select "Show Package Contents". Open the Contents folder and you should see Info.plist therein.