Sun Java Solaris Communities My SDN Account Join SDN
 
Tutorials & Code Camps

jGuru: Help: Testing the Java Environment with SimpleProgram

 


by jGuru

[Exercise | API Docs | Short Course| Exercises]

Help is available for each task.

    Task 1

    Copy and paste the code for SimpleProgram from the course notes into a file (or use the SimpleProgram.java file above) in a working directory where you will develop programs for this course.

    For most environments, the source code should be in a file named SimpleProgram.java. Some environments, however, are not source file-oriented (for example, VisualAge for Java), in which case you simply type the code into the appropriate IDE window(s).

    Task 2

    Compile the Java source file SimpleProgram.java.

    Some Java environments require a CLASSPATH setting. You should set the CLASSPATH environment variable to include the current directory. With the Java Development Kit (JDK) from Sun Microsystems, you can compile SimpleProgram.java easily from the command line:

    D:\>javac SimpleProgram.java
    

    Task 3

    Execute SimpleProgram.

    With the JDK, for example, simply invoke the Java interpreter with SimpleProgram as an argument:

    D:\>java SimpleProgram
    

Copyright 1996-2000 jGuru.com. All Rights Reserved.