Introduction
The JNode command shell allows commands to be entered and run interactively from the JNode command prompt or run from command script files. Input to entered at the command prompt (or read from a script file) is first split into command lines by a command interpreter; see below. Each command line is split into command name (an alias in JNode parlance) and a sequence of arguments. Finally, each command alias is mapped to a class name, and run by a command invoker.
The available aliases can be listed by typing
JNode /> alias<ENTER>
and an aliases syntax and built-in help can be displayed by typing
JNode /> help alias<ENTER>
More extensive documentation for most commands can be found in the JNode Commands index.
Keyboard Bindings
The command shell (or more accurately, the keyboard interpreter) implements the following keyboard events:
<SHIFT>+<UP ARROW> | Scroll the console up a line |
<SHIFT>+<DOWN-ARROW> | Scroll the console down a line |
<SHIFT>+<PAGE-UP> | Scroll the console up a page |
<SHIFT>+<PAGE-DOWN> | Scroll the console down a page |
<ALT>+<F1> | Switch to the main command console |
<ALT>+<F2> | Switch to the second command console |
<ALT>+<F7> | Switch to the Log console (read only) |
<ESC> | Show command usage message(s) |
<TAB> | Command / input completion |
<UP-ARROW> | Go to previous history entry |
<DOWN-ARROW> | Go to next history entry |
<LEFT-ARROW> | Move cursor left |
<RIGHT-ARROW> | Move cursor right |
<BACKSPACE> | Delete character to left of cursor |
<DELETE> | Delete character to right of cursor |
<CTRL>+<C> | Interrupt command (currently disabled) |
<CTRL>+<D> | Soft EOF |
<CTRL>+<Z> | Continue the current command in the background |
<CTRL>+<L> | Clear the console and the input line buffer |
Note: you can change the key bindings using the bindkeys command.
Command Completion and Incremental Help
The JNode command shell has a sophisticated command completion mechanism that is tied into JNode's native command syntax mechanisms. Completion is performed by typing the <TAB> key.
If you enter a partial command name as follows.
JNode /> if
If you now enter <TAB> the shell will complete the command as follows:
JNode /> ifconfig
with space after the "g" so that you can enter the first argument. If you enter <TAB>
again, JNode will list the possible completions for the first argument as follows:
eth-pci(0,16,0)
loopback
JNode /> ifconfig
This is telling you that the possible values for the first argument are "eth-pci(0,16,0)" and "loopback"; i.e. the names of all network devices that are currently available. If you now enter "l" followed by <TAB>, the shell will complete the first argument as follows:
JNode /> ifconfig loopback
and so on. Completion can be performed on aliases, option names and argument types such as file and directory paths and device and plugin names.
While completion can be used to jolt your memory, it is often useful to be able to see the syntax description for the command you are entering. If you are in the middle of entering a command, entering <CTRL-?> will parse what you have typed in so far against the aliases syntax, and then print the syntax description for the alternative(s) that match what you have entered.
The JNode command shell uses a CommandInterpreter object to translate the characters typed at the command prompt into the names and arguments for commands to be executed. There are currently 3 interpreters available:
The JNode command shell currently consults the "jnode.interpreter" property to determine what interpreter to use. You can change the current interpreter using the "propset -s" command; e.g.
JNode /> propset -s jnode.interpreter bjorne
Note that this only affects the current console, and that the setting does not persist beyond the next JNode reboot.
Command Invokers
The JNode command shell uses a CommandInvoker object to execute commands extracted from the command line by the interpreter. This allows us to run commands in different ways. There are currently 4 command invokers available:
The JNode command shell currently consults the "jnode.invoker" property to determine what invoker to use. You can change the current invoker using the "propset -s" command; e.g.
JNode /> propset -s jnode.invoker isolate
Note that this only affects the current console, and that the setting does not persist beyond the next JNode reboot.
If you want to test some java application, but don't want to recompile JNode completly every time you change your application, you can use the classpath command.
Set up your network, if you don't know how, read the FAQ.
Now you have to setup a webserver or tftp server on your remote mashine, where you place your .class or .jar files.
With the classpath command you can now add a remote path. E.g. "classpath add http://192.168.0.1/path/to/classes/". Using "classpath" without arguments shows you the list of added paths. To start your application simply type the class file's name.
For more info read the original forum topic from Ewout, read more about shell commands or have a look at the following example:
On your PC:
Install a Webserver (e.g. Apache) and start it up. Let's say it has 192.168.0.1 as its IP. Now create a HelloWorld.java, compile it and place the HelloWorld.class in a directory of your Webserver, for me that is "/var/www/localhost/htdocs/jnode/".
Inside JNode:
Type the following lines inside JNode. You just have to replace IP addesses and network device by values matching your configuration.
ifconfig eth-pci(0,17,0) 192.168.0.6
route add 192.168.0.1 eth-pci(0,17,0)
classpath add http://192.168.0.1/jnode/
now that a new classpath is added you can run your HelloWorld App by simply typing
HelloWorld