Complete guide to install LeJOS on Mac OS X 10.6

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

Moderators: 99jonathan, roger, imaqine

Did the tutorial solve your problem?

Yes
6
86%
No
1
14%
 
Total votes : 7

Complete guide to install LeJOS on Mac OS X 10.6

Postby jonasbg » Fri Sep 04, 2009 5:18 pm

Here follows a complete guide to install LeJOS on Mac OS X 10.6

1. install the 'Mac OS 10.5 (Leopard) Firmware Fix' from here: http://mindstorms.lego.com/support/updates/
2. download LeJOS 0.85 from http://lejos.sourceforge.net
3. extract your zip file to where ever you want, personally I put it in my user library.
Code: Select all
/Users/yourusername/Library/

4. set up the correct parameters through terminal
Code: Select all
sudo pico ~/.bash_profile

in this window enter these variables
Code: Select all
cd /Users/yourusername/Library/lejos_nxj
LEJOS_HOME=`pwd`
NXJ_HOME="$LEJOS_HOME"
PATH="$LEJOS_HOME/bin:$PATH"
export LEJOS_HOME NXJ_HOME
export PATH

Code: Select all
CTRL+O
saves the document,
Code: Select all
CTRL+X
exits the pico program

You'll have to logout/reboot to get these variable to load, but you don't have to do this yet

5. Set the right permission for your LeJOS content
Code: Select all
chmod -R 755 ~/lejos_nxj/


6. "Install" the fantom USB driver
Code: Select all
pico /Users/yourusername/Library/lejos_nxj/bin/nxj.properties

Then enter this parameter:
Code: Select all
NXTCommUSB=lejos.pc.comm.NXTCommFantom

Make sure to have NO spaces between "=" and after the sentence!


7. If you have Snow Leopard go to
/Applications/Utilities/Java\ Preferences
Image
and put your java 32 bit ahead of the 64 bit
Image

Sorry about the language in these screenshots, but you should be able to understand it just by the icons :)

Try it out by typing while the brick is plugged in and turned on:
Code: Select all
nxjbrowse -u



Great thanks to:
http://tucsontechnics.blogspot.com/2009 ... river.html
viewtopic.php?t=1186&start=0
http://tucsontechnics.blogspot.com/2009 ... k-pro.html

And not to forget, my student advicor in Norway!

If I've forgot anything, please ask, but in my memory, this was all that I did to get this to work.


---------------------------------------------
To compile project enter
Code: Select all
nxjc myProject.java

To transfer the project to the NXT brick
Code: Select all
nxj myProject
remember, without any suffix
Last edited by jonasbg on Wed Sep 30, 2009 1:04 pm, edited 7 times in total.
jonasbg
New User
 
Posts: 10
Joined: Fri Sep 04, 2009 10:39 am

Postby jonasbg » Fri Sep 04, 2009 5:38 pm

You might have to install developer tools from your Mac OS X dvd, or from developer.apple.com
jonasbg
New User
 
Posts: 10
Joined: Fri Sep 04, 2009 10:39 am

Postby barberkost » Fri Sep 04, 2009 8:49 pm

Awesome! Totally missed the part about 64/32 bit, have been struggling with this all afternoon.

You might also have to correct permissions on the folder.

Code: Select all
chmod -R 755 ~/lejos_nxj/bin
barberkost
New User
 
Posts: 1
Joined: Fri Sep 04, 2009 8:47 pm

Postby jonasbg » Fri Sep 04, 2009 8:54 pm

barberkost wrote:Awesome! Totally missed the part about 64/32 bit, have been struggling with this all afternoon.

You might also have to correct permissions on the folder.

Code: Select all
chmod -R 755 ~/lejos_nxj/bin



Aaah, essential! Just forgot about that :)
jonasbg
New User
 
Posts: 10
Joined: Fri Sep 04, 2009 10:39 am

Re: Complete guide to install LeJOS on Mac OS X 10.6

Postby Shawn » Fri Sep 04, 2009 10:03 pm

Thanks for the tutorial!!!!!!!:P :P

jonasbg wrote:
6. "Install" the fantom USB driver
Code: Select all
pico /Users/yourusername/Library/lejos_nxj/bin/nxj.properties

Then enter this parameter:
Code: Select all
NXTCommUSB=lejos.pc.comm.NXTCommFantom

Make sure to have NO spaces between "=" and after the sentence!


From .85 step #6 isn't necessary. It's configured by default.



jonasbg wrote:
---------------------------------------------
To compile project enter
Code: Select all
nxjc myProject.java

To transfer the project to the NXT brick
Code: Select all
nxj myProject
remember, without any suffix


Also, if you want to use the pcapi (for programs that run on your computer and communiticate with the NXT brick):

To compile using the pc api enter
Code: Select all
nxjpcc myPcApiClass.java

To run the code to the NXT brick
Code: Select all
nxjpc myPcApiClass
remember, without any suffix
User avatar
Shawn
Advanced Member
 
Posts: 723
Joined: Wed Sep 12, 2007 4:59 am
Location: Tokyo

Postby jonasbg » Sat Sep 05, 2009 2:03 pm

feedback on how to improve this guide is welcome :)
jonasbg
New User
 
Posts: 10
Joined: Fri Sep 04, 2009 10:39 am

Postby alexlesuper » Sat Sep 12, 2009 8:02 pm

For part 7, in Snow Leopard it's actually
/Applications/Utilities/Java\ Preferences
alexlesuper
New User
 
Posts: 4
Joined: Sat Sep 12, 2009 7:38 pm

Postby n1maddin » Mon Sep 14, 2009 3:15 am

hey guys,

sorry I am complete newbie to this area. I tried everything to do as posted, but get

leJOS NXJ> Failed to load USB comms driver: Cannot load USB driver
leJOS NXJ> Failed to find any NXTs
No NXT found - is it switched on and plugged in (for USB)?

even though it is plugged in, and connected (the lego software can connect to it)

any ideas?

thx
n1maddin
New User
 
Posts: 10
Joined: Mon Sep 14, 2009 3:14 am

Postby Shawn » Mon Sep 14, 2009 6:33 am

n1maddin wrote:hey guys,
leJOS NXJ> Failed to load USB comms driver: Cannot load USB driver
leJOS NXJ> Failed to find any NXTs
No NXT found - is it switched on and plugged in (for USB)?


What version of LeJOS- 0.85? .8?
What version of OSX? PPC or intel?
What version of the mindstorms software you do have? 1.05? 1.02?
n1maddin wrote: I tried everything to do as posted


Can you tell us what you did?

Actually you don't need this anymore - /Users/yourusername/Library/lejos_nxj/bin/nxj.properties It is a source of potential error so you may want to just remove it (assuming you are on LeJOS .85).

Finally, how are you starting your program. If it's from eclipse, you need to get the driver in the path. What happens if you try ./nxjbrowse from your /bin folder (on a command line).

Shawn
User avatar
Shawn
Advanced Member
 
Posts: 723
Joined: Wed Sep 12, 2007 4:59 am
Location: Tokyo

Postby n1maddin » Mon Sep 14, 2009 2:08 pm

Hi,

I am using .85 with an Intel Mac.

The mindstorms software seems to be 2.0 ?! That is what it says when I klick on "About Lego Mindstorms NXT" in the application.

I am not using eclipse yet, I just use the terminal. This is the output I get when I type in ./nxjbrowse:


leJOS NXJ> Failed to load USB comms driver: Cannot load USB driver
leJOS NXJ> Searching for any NXT using Bluetooth inquiry
Native Library bluecove not available
leJOS NXJ> Search Failed: BlueCove library bluecove not available
leJOS NXJ> Failed to find any NXTs
No NXT found - is it switched on and plugged in (for USB)?

This how my /Users/martin/.bash_profile looks:

Code: Select all
cd /Users/martin/Library/lejos_nxj
LEJOS_HOME=`pwd`
NXJ_HOME="$LEJOS_HOME"
PATH="$LEJOS_HOME/bin:$PATH"
export LEJOS_HOME NXJ_HOME
export PATH

This is how /etc/profile looks like:

Code: Select all
# System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
        eval `/usr/libexec/path_helper -s`
fi

if [ "${BASH-no}" != "no" ]; then
        [ -r /etc/bashrc ] && . /etc/bashrc
fi
     ## setloginpath added /usr/local/bin start at Fri Nov  2 18:44:47 EDT 2007
     ## Do not remove the previous line
     if [ `whoami` != "root" ]
     then
       export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home"
       export NXJ_HOME="/Users/martin/Library/lejos_nxj"
       export DYLD_LIBRARY_PATH="$NXJ_HOME/bin"
       PATH="$PATH:$NXJ_HOME/bin:$JAVA_HOME/bin"
       export PATH
     fi
     ## Do not remove the next line
     ## setloginpath added /usr/local/bin end at Fri Nov  2 18:44:47 EDT 2007
~     

any more you need to know?

many thanks for the help![/code]
n1maddin
New User
 
Posts: 10
Joined: Mon Sep 14, 2009 3:14 am

Postby Shawn » Mon Sep 14, 2009 10:03 pm

n1maddin wrote:Hi,

I am using .85 with an Intel Mac.

The mindstorms software seems to be 2.0 ?!


I don't know if we have any lego 2.0 mac users. I used the most recent SDK from lego http://mindstorms.lego.com/Overview/nxtreme.aspx, so if there is a newer version that we need to build against, I don't have it.

Try this
Code: Select all
cat /Library/Frameworks/Fantom.framework/Resources/Info.plist
What version of the driver do you have. Mine says LEGO MINDSTORMS NXT Driver 1.1.1f0

n1maddin wrote:leJOS NXJ> Failed to load USB comms driver: Cannot load USB driver


Did you switch Java to 32 bit for all applications?
User avatar
Shawn
Advanced Member
 
Posts: 723
Joined: Wed Sep 12, 2007 4:59 am
Location: Tokyo

Postby n1maddin » Mon Sep 14, 2009 10:28 pm

Code: Select all
:lejos_nxj martin$ cat /Library/Frameworks/Fantom.framework/Resources/Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>CFBundleDevelopmentRegion</key>
   <string>English</string>
   <key>CFBundleExecutable</key>
   <string>Fantom</string>
   <key>CFBundleIdentifier</key>
   <string>com.ni.framework.Fantom</string>
   <key>CFBundleInfoDictionaryVersion</key>
   <string>6.0</string>
   <key>CFBundleName</key>
   <string>Fantom</string>
   <key>CFBundleGetInfoString</key>
   <string>LEGO MINDSTORMS NXT Driver 1.1.1f0, Copyright (c) 2003-2007 National Instruments Corporation. All Rights Reserved.</string>
   <key>CFBundlePackageType</key>
   <string>FMWK</string>
   <key>CFBundleSignature</key>
   <string>????</string>
   <key>CFBundleShortVersionSring</key>
   <string>1.1.1</string>
   <key>CFBundleVersion</key>
   <string>f0</string>
</dict>
</plist>


I think I have the same as you. Yes, I have switched the order of the Jave SE to 32Bit infront of 64Bit under Java Preferences

But I still get the same error :(
n1maddin
New User
 
Posts: 10
Joined: Mon Sep 14, 2009 3:14 am

Postby n1maddin » Mon Sep 14, 2009 11:46 pm

ha... I did it :)

I had to set everything up just for my user in the /.profile file... for all users wouldnt work.

but, just one more problem:

Code: Select all
compile:
    [javac] Compiling 1 source file to /Users/martin/Documents/LEGO Creations/workspace/projects/samples/BlueStats
    [javac] /Users/martin/Documents/LEGO Creations/workspace/projects/samples/BlueStats/BlueStats.java:1: package lejos.nxt does not exist
    [javac] import lejos.nxt.*;
    [javac] ^
    [javac] /Users/martin/Documents/LEGO Creations/workspace/projects/samples/BlueStats/BlueStats.java:2: package lejos.nxt.comm does not exist
    [javac] import lejos.nxt.comm.*;
    [javac] ^
    [javac] /Users/martin/Documents/LEGO

 ..

cannot find symbol
    [javac] symbol  : variable LCD
    [javac] location: class BlueStats
    [javac]          LCD.refresh();         
    [javac]          ^
    [javac] 27 errors

BUILD FAILED
/Users/martin/Documents/LEGO Creations/workspace/projects/samples/BlueStats/build.xml:23: The following error occurred while executing this line:
/Users/martin/Documents/LEGO Creations/workspace/projects/samples/samplebuild.xml:25: Compile failed; see the compiler error output for details.

Total time: 1 second


any help?
:)
n1maddin
New User
 
Posts: 10
Joined: Mon Sep 14, 2009 3:14 am

Postby Shawn » Tue Sep 15, 2009 3:42 am

If you are not finding the jars when you build with ANT, there should be a samples.properties file that points to the jars you need. Have a look at it and make sure the paths are right.
User avatar
Shawn
Advanced Member
 
Posts: 723
Joined: Wed Sep 12, 2007 4:59 am
Location: Tokyo

Postby n1maddin » Tue Sep 15, 2009 3:47 am

Hey,

wow that got me a little further, I just hard-coded my path, now I have this problem:

Code: Select all
uploadandrun:
     [java] leJOS NXJ> Failed to load USB comms driver: Cannot load USB driver
     [java] leJOS NXJ> Searching for any NXT using Bluetooth inquiry
     [java] Native Library bluecove not available
     [java] leJOS NXJ> Search Failed: BlueCove library bluecove not available
     [java] leJOS NXJ> Failed to find any NXTs
     [java] leJOS NXJ> Failed to connect to any NXT
     [java] An error occurred: No NXT found - is it switched on and plugged in (for USB)?
BUILD SUCCESSFUL
Total time: 1 second


... I am really trying to get this two work since 2 days now, I am really getting desperate :(
n1maddin
New User
 
Posts: 10
Joined: Mon Sep 14, 2009 3:14 am

Next

Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 3 guests

more stuff