Getting Started
Home Up J2EE JDBC Getting Started

Downloading and Installing Software

Installing Sun's Free Java

Install the Java Run-time Environment (JRE) and J2SE.

A Better Development Environment for NT/Win2K

It is possible for NT/Win2K users to use notepad. However, see our installation instructions for

  1. Cygwin
  2. Emacs for NT/Win2K (if applicable) or just download directly.
  3. Java Developement Environment (JDE) or just download directly

Check out the online books and documentation on Java.

Compiling Your First Program

You can simply compile the program below with these simple commands

javac ConsoleInput.java

java ConsoleInput

Note the missing file extension on the second command. This is very important.

A Better Hello World Program

Note that his must be stored in a file called ConsoleInput.java. Case is important even if you are working on a Microsoft platform. You many download this to save typing.

/* 1*/// Demonstrate basic console I/O
/* 2*/ 
/* 3*/import java.io.*;
/* 4*/public class ConsoleInput {
/* 5*/    public static void main(String args[]) {
/* 6*/        BufferedReader in=new BufferedReader(
/* 7*/            new InputStreamReader(System.in));
/* 8*/        PrintStream out=System.out;
/* 9*/        try{
/*10*/            out.print("What is your name? ");
/*11*/            String name = in.readLine();
/*12*/            if(name == null)
/*13*/                out.println("No name! end of file detected");
/*14*/            else
/*15*/                out.println("Hello there "+name);
/*16*/        }
/*17*/        catch(java.io.IOException e){
/*18*/            out.println("Java.io.IOException: "+e.toString());
/*19*/        }
/*20*/    }
/*21*/}

Compiling with the JDE

Start emacs and use the command c-x c-f to open a new or existing file. In this case we want to edit ConsoleInput.java. To execute this command, hold the control key down and simultaneously depress the "x" key. Release the "x" key and, while still depressing the control key, depress the "f" key. It should prompt you for a file name to which you can respond with ConsoleInput.java.

Now issue the command c-c c-v c-c to compile. If there are any syntax errors, emacs will position you to the position of the error in response to c-x ` (that last character is known as a backquote or grave and often resides below the ~ character).

If you have no errors, you may now run your program by typing c-c c-v c-r and observer the results.

 

Home Up Feedback Contents Search

Send mail to webmaster@SIGNITEK.com with questions or comments about this web site.