CS 001: Command Line Help


Using the command line

To get a command prompt select"Start->Run" and type "cmd". Once in the command prompt you can run any of the lejos commands or use any of the following common commands:

  • dir - gives you a listing of the files/subdirectories in your current directory ("ls" in Unix).
  • cd - changes which directory you are in ("cd" in Unix). Type the directory name to move down into a directory and ".." to move up a directory. Multiple directories can be combined by using back slash. For example, when I first start up command I am in c:\Documents and Settings\robolab. By typing. "cd ..\..\lejos\bin" I move up two levels (to the root of the C drive) and then move back down into the binary bin for leJOS.
  • mkdir - makes a directory ("mkdir" in Unix). For example "mkdir robot" will make a new directory called robot in whatever directory you are currently in.
  • move - moves a file ("mv" in Unix). For example "move SimpleSimon.java robot" will move the file SimpleSimon into the directory named robot.
  • del - deletes a file ("rm" in Unix). For example, "del SimpleSimon.java" will remove the given file.
  • edit - A very simple text editor (sort of like pico in Unix). You may use this to write or edit java code, although you may also use jGrasp since you are used to it.

Hints

  • Your prompt shows you which drive/directory you're currently in
  • If you open command and need to change to the C drive just type 'C:'

LeJOS NXJ Commands

  • nxjflash - flashes the firmware. Note the NXT brick has to be in firmware reset mode for this to work. To put your brick in firmware mode use a paperclip to press the reset button in the top left hole on the back of the NXT brick til it beeps
  • nxjc [something.java] - compiles a Java program for leJOS
  • nxj [something] - links, uploads and optionally runs a leJOS program

Example Usage - to compile and upload/run the program TestMe.java:

  • if the lejos firmware is not loaded, press the reset button in the top left hole on the back of the NXT brick then type the command 'nxjflash'
  • nxjc TestMe.java
  • nxj TestMe