Checking your Java environment (for use with leJOS)

To use leJOS you need 32 bits versions of the JDK and the Java Runtime Environment (JRE). Also, sometimes after updates of Java or multiple removals/additions the environment can ‘go bad’.

Follow the steps below to test the environment and fix it when necessary.

Test Java

Windows must be able to find Java programs. Therefore the Java folder should be added to the PATH variable of Windows. You can check this by executing the command ‘java -version’ on the command-prompt:

Click Start.
Type ‘cmd’ in the search field and press Enter.
In the command-prompt Window, type ‘java -version‘ and hit Enter.

If an error is displayed that says that the command can not be found, you will have to adjust the PATH settings. You can read how to do this in the section below.

If information about the installed Java version is displayed, check if it is 32 or 64 bits:

If the last line contains the word ‘64-Bit‘ you have the wrong version. Remove all Java programs and install the proper version (32 bits, which comes with the zip-package of my course Applicatiebouw).

If the last line does NOT contain the word ‘64-Bit‘ , the installation is fine.

Adjust the PATH setting of Windows

Go to the Control Panel and click ‘System’ or right click ‘This PC’ in the Windows Explorer and select ‘Properties’
Select ‘Advanced System Settings’.
Go to tab ‘Advanced’ and click ‘Environment Variables…’.
Search the second list (under System Variables) for ‘Path’ and select it.
Press ‘Edit’.
In older Windows versions: Adjust the value ‘Variable Value’. The path to the Java bin folder must be added here. Beware that there are multiple folders separated by semicolons ‘;’. In Windows 10, you can edit the value using the dialog that appears.

The path list should contain the path “C:\ProgramData\Oracle\Java\javapath” (if you use the latest Java version). If it is not there add it to the list. If there are other entries (eg. from older Java versions), remove them.

 

You will have to restart your computer for the changes to have effect.

Checking environment variables of LeJOS

LeJOS needs the environment variable ‘LEJOS_NXT_JAVA_HOME’ to point to the right folder.

Click Start.
Type ‘cmd’ in the search field and press Enter.
In the command-prompt Window, type ‘set‘ and hit Enter.

Review the list and compare the highlighted variables with the ones listed in the image below.

To change these variables you can follow the procedure in the section above (apply it to the variable ‘LEJOS_NXT_JAVA_HOME’ instead of ‘PATH’).

All correct variables for the latest Java version (1.8.0_121) as output by the ‘set’ command are highlighted in red below.

check_java