Hello World Example

Team-Fly

“Hello World” Example

To test the Java SDK compiler, you can develop a small stand-alone application that will simply print a character string to the screen. Traditionally, the “Hello World” string is used for this simple test; the sample code for this test follows. Enter it using any standard text editor, and save it under the file name jsape1.java.

/**   * This class implements an application that simply displays  * "Hello World!" to the screen  */ public class jsape1 { public static void main(String[] args)         {         System.out.println("Hello World!");         } }

To compile this program, open up a DOS window and type in the following command.

javac jsape1.java 

You can then run your program by typing in:

java jsape1

The compilation and execution of this example is shown in Figure D.11.

If you encounter a problem with the compilation step, carefully review the code and ensure that you typed it in exactly as it is shown. If you get a “Command not found” error, then you probably do not have your path set up correctly; check the “Installing the Java 2 SDK” section earlier in this chapter to make sure that it is set correctly.

click to expand

Figure D.11: The compilation of the jsape1.java “Hello World” example


Team-Fly


Java & BAPI Technology for SAP
Java & BAPI Technology for SAP
ISBN: 761523057
EAN: N/A
Year: 1998
Pages: 199

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net