Lejos on Mac OS X with Java 7 (64 Bit only)

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: roger, 99jonathan, imaqine

Lejos on Mac OS X with Java 7 (64 Bit only)

Postby phdoerfler » Sun Oct 28, 2012 1:32 pm

Greetings!

in case it has not been brougth to your attention: New Java versions for Mac OS X are 64 Bit only and do not provide a way to run code in 32 bit mode (no -d32). I am currently investigating how much effort it is to have NXJ (and only NXJ) use the old Java 6 from Apple, which does include a 32 bit mode. This is however not a permanent solution, because as to my current understanding newer macs will not have a Java 6 supplied from Apple any longer.

How are you going to deal with that problem? There are multiple things coming to my mind right now:

  • Try to find a way to communicate with the brick and libraries in 64 bit mode (might not be possible technically)
  • Compile an own 32bit version of OpenJDK 7 for Mac OS X (that should not be that hard according to this blog post)
  • Rely on SoyLatte
  • Support NXJ on Mac only for Macs who still have Apple's Java 6 with them
For those wondering: Java 6 hides there: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home

Please tell how you are going to deal with that issue.

Thanks and best wishes
~ Philipp

Edit: Added the "Home" sub directory to the Java 6 path to get a JDK with the correct directory layout
Last edited by phdoerfler on Sun Oct 28, 2012 1:54 pm, edited 2 times in total.
phdoerfler
New User
 
Posts: 2
Joined: Sun Oct 28, 2012 1:07 pm

Re: Lejos on Mac OS X with Java 7 (64 Bit only)

Postby skoehler » Sun Oct 28, 2012 1:52 pm

phdoerfler wrote:in case it has not been brougth to your attention: New Java versions for Mac OS X are 64 Bit only and do not provide a way to run code in 32 bit mode (no -d32).


I am aware of that.

phdoerfler wrote: I am currently investigating how much effort it is to have NXJ (and only NXJ) use the old Java 6 from Apple, which does include a 32 bit mode. This is however not a permanent solution, because as to my current understanding newer macs will not have a Java 6 supplied from Apple any longer.


set the LEJOS_NXT_JAVA_HOME variable to the root directory of Java 6, and you should be fine.

phdoerfler wrote:How are you going to deal with that problem? There are multiple things coming to my mind right now:

  • Try to find a way to communicate with the brick and libraries in 64 bit mode (might not be possible technically)
  • Compile an own 32bit version of OpenJDK 7 for Mac OS X (that should not be that hard according to this blog post)
  • Rely on SoyLatte
  • Support NXJ on Mac only for Macs who still have Apple's Java 6 with them
For those wondering: Java 6 hides there: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0
Apple's JDK uses a different directory layout than Oracle's. As Lejos expects the directory layout of Oracle's JVMs, this might be a problem. I will try creating a fake JDK with Oracle's layout but symlinking to Apple's files.

Please tell how you are going to deal with that issue.


Lego is not going to provide a 64Bit driver, as it seems. Simply because their applications are 32Bit only.
It was rumored, that somebody wrote a C program for OSX that would talk to the NXT via OSX's native USB API. However, the source was never published and any attempt to find out who wrote the program was unsuccessful so far.
That Apple's JDK has a different layout than Oracle's is news to me. I have successfully run leJOS using /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home as JAVA_HOME/LEJOS_NXT_JAVA_HOME (which is the path suggested in our tutorial on how to install leJOS on OSX).
Shipping a seperate JDK for leJOS is somewhat cumbersome. Also, Eclipse would have to run with that JDK if the Eclipse plug-in is supposed to work.

I believe, there are two sensible options:
1) Have our own driver for the NXT or use some OSX API for USB access that doesn't require a special driver
2) instead of loading a JNI library, start an external OSX binary (32bit) which uses the Lego driver to communication with the NXT

libusb for OSX might be a possibility too. But I vaguely recall that it has been tried before and didn't work nicely.

BTW: I don't own a Mac. As you might know, Apple thinks it a great idea that people that want to developer for OSX need to buy a Mac. I won't.
Only one other project member has a Mac (Shawn) but he's not actively researching this issue, AFAIK.
skoehler
leJOS Team Member
 
Posts: 1114
Joined: Thu Oct 30, 2008 4:54 pm

Re: Lejos on Mac OS X with Java 7 (64 Bit only)

Postby phdoerfler » Sun Oct 28, 2012 2:04 pm

Thanks for your quick reply!

skoehler wrote:Lego is not going to provide a 64Bit driver, as it seems. Simply because their applications are 32Bit only.
It was rumored, that somebody wrote a C program for OSX that would talk to the NXT via OSX's native USB API. However, the source was never published and any attempt to find out who wrote the program was unsuccessful so far.

Ah that's unfortunate.

skoehler wrote:That Apple's JDK has a different layout than Oracle's is news to me. I have successfully run leJOS using /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home as JAVA_HOME/LEJOS_NXT_JAVA_HOME (which is the path suggested in our tutorial on how to install leJOS on OSX).

Sorry that was a mistake at my side. I somehow overlooked that "Home" directory so I assumed all binaries would reside in the "Commands" directory. When using "Home" as JDK home, everything should be fine, indeed.

skoehler wrote:Shipping a seperate JDK for leJOS is somewhat cumbersome. Also, Eclipse would have to run with that JDK if the Eclipse plug-in is supposed to work.

Absolutely. Shipping would be cumbersome.

skoehler wrote:I believe, there are two sensible options:
1) Have our own driver for the NXT or use some OSX API for USB access that doesn't require a special driver
2) instead of loading a JNI library, start an external OSX binary (32bit) which uses the Lego driver to communication with the NXT

Those are good ideas as well. In addition, I hope that even if new macs do not ship with Java 6, one might still be able to download it from apple. I am a bit hesitant to rely on anything from Apple regarding Java right now, though.

Best wishes
~ Philipp
phdoerfler
New User
 
Posts: 2
Joined: Sun Oct 28, 2012 1:07 pm


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 0 guests

cron
more stuff