[ssh (Putty) ]
[Tutorial - Unix]
[Tutorial - PC]
This page will demonstrate how to compose, compile, and run a minimum Java
program and a slightly more advanced Java program remotely on the machine mode. You will not learn "why" the programs work from this page.
Note that when you execute Java programs remotely (i.e. on mode), you are unable to use the GUI (Graphical User Interface) features that Java is able to incorporate into programs. When using mode, you are only able to do command line input and output. Furthermore, it is a very complicated task to have command line input. Therefore, it is often best to "hard code" your input values directly into the program.
Begin by logging onto mode.
If you are not sure how to do this,
make sure you read the information under the "Login Procedure" category in this guide.
Minimum Program: At the mode prompt, type "pico MinProcApp.java" (
no quotes), and press enter.
Then, use the text editor Pico to enter the text as seen below.
Now, save your file and quit pico.
Once you are back at the mode prompt, we need to compile our program. To do this type
"javac MinProcApp.java" (no quotes), and press enter.
If you receive error messages, use Pico to edit the file and fix the mistakes. Then, re-compile your
program as previously instructed. If there are no compiler error messages, you should see a
file called "MinProcApp.class" in your current working directory.
Type "ls" (no quotes) at
the mode prompt to see that this file has indeed been created by the compiler. This is your
executable (runnable) file.
Now, to run your file, type "java MinProcApp" (no quotes) at the mode prompt. You
should see output similar to that below.
Advanced Program: Fire up Pico on a new file named "SmallApp.java" and enter
text as seen below.
Compile and run your program. Can you figure out how it worked?
Questions? e-mail: consult