![]() |
![]() |
Getting Started on OS X
|
Getting Started on OS X
This version of the tutorial is for the 0.9 release of leJOS NXJ and is compatible with OS X 10.4 or higher and both intel and ppc processors. PrerequisitesJava Development KitYou will also need a Java Development Kit (JDK). Note that a Java Runtime Environment
(JRE) is not sufficient as it does not allow you to compile Java programs.
A full JDK already ships with OS X or it can be installer on demand.
Try the 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 USB DriverTo run leJOS NXJ on OS X you will need a suitable USB driver on your PC. If you have installed the standard LEGO Mindstorms NXT-G software, a suitable driver (the so-called Fantom driver) is already installed. If you do not wish to install the LEGO software on your PC or if you want to update the Fantom driver to the latest version, you can get an installer from The LEGO Mindstorms site. It is strongly recommended to update to the latest version (1.1.3 at the time of writing). (Optional) BluetoothIf you want to communicate with the NXT over Bluetooth, you will need a Linux supported Bluetooth dongle or built-in support on your PC. leJOS uses the Bluecove libraries which are included in the distribution. You can use leJOS NXJ without Bluetooth. Pairing the NXT with your Mac should be done by pair from the computer. Browse for the device and enter a passcode of 1234 on the mac. Installing leJOSDownloading the softwareYou can download the leJOS NXJ software from The leJOS NXJ download page. The OS X edition of leJOS is distributed as a .tar.gz archive. Untar the archive to a location of your choice. You may delete the build subfolder, since it is required for Linux only. Setting up environment variablesleJOS NXJ needs to know the locations of java.exe and javac.exe. There are several possibilities
to achieve that: (1) add the bin directory of the JDK to your PATH environment variable
so that commands such as Furthermore, the NXJ_HOME variable should be set to the directory where leJOS NXJ is installed. It allows other applications, e.g. the Ant scripts, to locate the leJOS Development Kit. Also, for easy exececution of the leJOS commands on the command line, the bin folder of the leJOS distribution should be added to the PATH variable. Examples:
The bin directory for the JDK may already be on your PATH. In that case, it is unnecessary to set LEJOS_NXT_JAVA_HOME or JAVA_HOME, unless you want to have multiple JDKs on your system and want to select a specific JDK for use with leJOS. You can set these environment variables either as user or system variables depending on whether you want leJOS NXJ to be available to just the current user or to all users. To set the environment variables for the current user only, create and edit
To set the environment variables for all users, edit the file
Note, that the above assumes that leJOS has been moved to
Flashing the FirmwareAs leJOS NXJ is a firmware replacement, you will need to flash the firmware to your NXT. Note that this will overwrite any existing firmware. If you have the standard LEGO firmware or other third-party firmware on your NXT, existing files will be lost. Note that the 0.9 release changes the amount of flash memory reserved for the firmware and the startup menu, so when you first flash the 0.9 firmware any existing files will be lost Make sure your NXT is attached to the PC via USB cable and switch it on by pressing the
orange button. Open a command line prompt and either type the command If you chose If you chose Testing your InstallationYou can test your installation by following the steps for writing your first leJOS Program which are the next part of this tutorial. |
|