3

I am working with an eclipse plugin that requires it to run 32bit Java 6 on it and I do have Java 6 on my computer but when I run the program I get this error.

Error: This Java instance does not support a 32-bit JVM.
Please install the desired version.
Linking the file failed with exit status 1

The Java 6 I installed was from Apple's legacy Java 2015. In the installation tutorial of leJOS it said that

Note that even if you have a 64-bit system, leJOS will always chose to run java in 32 Bit mode by automatically passing the -d32 parameter to the java command whenever necessary.

If that is the case why doesn't my program run if I have Legacy Java 6 installed on my Mac? Can anyone get it to work on their mac on this version macOS?

1
  • I've gotten it to work on Sierra, minus Bluetooth support. There are a couple of hoops to jump through, that aren't made clear. I'll write up an answer later when I have time. Commented May 23, 2017 at 20:25

2 Answers 2

3

I've managed to get leJOS working on macOS Sierra, minus Bluetooth support. Bluetooth support is officially broken and has been for a while. There also hasn't been a new release in years, so a fix likely won't come. Otherwise it still works, if you jump through some hoops.

Guide:

1. Fantom Driver:

First, you need to install the "Fantom driver". You can find on the Mindstorms download page.

Extract that ZIP, and you should have a installer package named MAC legodriver.pkg. Unfortunately, it may or may not install. Some people say it installs for them, but it doesn't install for me.

If it doesn't install, someone has created a script that can unpack the installer and get around the compatibility issues.

2. Legacy Java 6 with 32-bit support:

You need to install Apple's legacy Java 6 package with 32-bit support. Sierra isn't listed as supported, but it still works.

This legacy version of Java probably won't become the default if you have a new version installed, but that's fine, we will configure leJOS to use this version later.

(Incidentally, there were some plans to make it support 64-bit Java, but I wouldn't hold my breath.)

3. Download leJOS:

Download and extract leJOS for Mac as instructed here.

4. Setup environment:

You need to setup some environment variables as vaguely specified here. You will want to add something like the following to your .bash_profile, .profile, or other shell startup script, adjusting the NXJ_HOME to where you extracted leJOS.

# leJOS
export LEJOS_NXT_JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home"
export NXJ_HOME="/Users/<USER>/<PATH_TO>/LeJOS/leJOS_NXJ_0.9.1beta-3"
export PATH="$PATH:$NXJ_HOME/bin"

(The LEJOS_NXT_JAVA_HOME variable is how you tell leJOS to use the legacy Java version.)

5. Profit:

Now when you open a new shell, the leJOS commands should work.

6
  • are you running eclipse Neon or an older version of Eclipse? Commented May 24, 2017 at 2:07
  • @ProgrammingCuber I've never used the Eclipse plugin. I'm afraid I don't know anything about it. Commented May 24, 2017 at 2:08
  • well if you could try it out and see if it works I would be interested :) just search the marketPlace and install it from there. Since you have the other things working it should be fine. Just upload the NXT firmware and then try to run a simple program and see what it outputs. Commented May 24, 2017 at 2:12
  • I did do everything in your tutorial but I still have problems running it I still get the same error, I can't run it in eclipse. Commented May 24, 2017 at 2:35
  • @ProgrammingCuber If it's the 32-bit error, you might need to configure Eclipse to use a specific Java runtime or something. Not sure, I haven't used Eclipse in years. Commented May 24, 2017 at 2:37
2

The one thing I needed to change to make the above solution work was this:

LEJOS_NXT_JAVA_HOME="/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home"

I hope this can be of help to someone.

Wim

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.