CTG - Java Tutorial for Windows

Overview
  [Supercomputing]
  [Project Development]
  [Project Design]

Login Procedure
  [ssh (Putty) ]
  [Tutorial]

Unix
  [Basic Commands]
  [Utilities]
  [Pico]
  [Cygwin]

C++
  [Background]
  [Tutorial]
  [Advanced Syntax]

Java
  [Background]
  [Tutorial - Unix]
  [Tutorial - PC]
  [Advanced Syntax]

Graphics
  [gnuplot]
  [Tutorial]

Extras
  [Cygwin-X11]
  [E-mail]
  [ftp]
  [HTML]
  [Resources]

Supercomputing Challenge
  [Home Page]
  [Technical Guide]

This page will demonstrate how to compose, compile, and run a minimum Java program (Minimum Procedural Application), and a slightly more advanced Java program, on your local PC running Windows. You will not learn why the programs work from this page.

To install the Java SDK (Software Development Kit) on your school/home PC, check out our Informational Java page.

Begin by oppening up an MS-DOS Prompt. Then, at the prompt, enter "edit MinProcApp.java" (without the quotes). Use the "edit" text editor to enter the text in the file MinProcApp.java.

Optional: If you want to better organize your files and folers, you can study some extra DOS commands.

Your text should look similar to what you see below:

Now, save your file and quit using the edit tool by accesing the functions from the "File" pull-down menu within the text editor.

Once you are back at the DOS prompt, we need to compile our program. To do this type "javac MinProcApp.java" (no quotes), and press enter.

Note that this assumes that your PATH variable has been correctly set so that the system knows where to find the Java compiler!

If you receive error messages, edit the file (type "edit MinProcApp.java") 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 "dir" (no quotes) at the DOS prompt to see that this file has indeed been created by the compiler. This is your executable (runnable) file. If the file listing went by the screen too fast for you to read, try using "dir/w" or "dir/p" as your listing command.

Now, to run your file, type "java MinProcApp" (no quotes) at the DOS prompt. You should see output similar to that below.


Advanced Program: Fire up "edit" on a new file named "SmallApp.java" and enter text in the file SmallApp.java.

Your text should look similar to what you see below:

Compile and run your program. What does this "Small Application" do? Can you figure out how it works?


Supercomputing ChallengeQuestions? e-mail: consult