IBM

Hello World application

This example is really very simple indeed (also available as a plain ASCII file):


  /* This is a fully documented NetRexx program */

  say 'Hello World!'

The first line is a comment, which isn't really needed. The second line is a NetRexx instruction called say, which takes an expression (here just a constant string) and displays it.

To compile and run the program, you'd create a plain text file containing the two lines above (or just the second line) in your current directory, and then enter the command:


  java COM.ibm.netrexx.process.NetRexxC hello

This would:

  1. Call the NetRexx translator to translate the program from NetRexx to Java
  2. Call the Java compiler (javac) to compile the program into a class file

You can then run the program using the command:


  java hello

This calls the Java interpreter (java) to interpret the class file, which should then display "Hello World!".

Note that the Java runtime (e.g., from the Java Development Kit) must be installed.

If you have the netrexxc command script available, you can compile and run the sample using just:


  netrexxc -run hello

If you have Java 2 (Java version 1.2 or later) installed, you can run the program without compiling it, using the NetRexx interpreter, using either of:


  java COM.ibm.netrexx.process.NetRexxC hello -exec -nojava

  netrexxc hello -exec -nojava


[ IBM | Help | Legal | Privacy ]