Installation of the NetRexx compiler


Here's how to install the NetRexx compiler and runtime classes. These instructions apply to the majority of Java platforms (for use with Visual J++, please see below).

  1. Copy the 'nrtools.zip' or 'nrtools.tar.Z' file from the NetRexx documentation directory to the Java home directory, using the original name. The name of the Java home directory will vary depending on the operating system you are using. Some possibilities are:
      /java 
      \java11
      \jdk1.1
    

    It will contain directories such as 'bin' and 'lib'.

    [Note: if your Java home directory is on a CD-ROM, or otherwise inaccessible, you'll need to choose a different directory and set up a CLASSPATH environment variable that points to it. Consult your Java toolkit documentation for details on how to do this.]

  2. With the Java home directory as your current directory, unpack the package, following the instructions in "Unpacking NetRexx packages" above.

    This should add the .zip files for the NetRexx runtime and compiler classes (NetRexxR.zip and NetRexxC.zip) to the Java 'lib' directory.

    In addition, some sample scripts and a test program should have been added to the Java 'bin' directory:

      hello.nrx    -- a simple NetRexx program for testing
      NetRexxC.cmd -- the NetRexx compiler command in Rexx
      NetRexxC.bat -- similar NetRexx compiler command (Windows .bat)
      nrc.cmd      -- shorter name for NetRexxC.cmd
      nrc.bat      -- shorter name for NetRexxC.bat
    

    The .cmd files are simple Rexx scripts for making it easier to use the compiler. You don't have to use these, but they save some typing. They should require little modification to run under the Rexx interpreter for your platform; for details of Rexx interpreters, see: http://www2.hursley.ibm.com/rexx/

    Under Windows, the .bat files should serve the same purpose -- they are not as flexible as the Rexx .cmd files, but will save typing.

  3. Check that the names are correct in the 'lib' directory: there should be a file in the directory called 'NetRexxC.zip'; if the name is all in upercase or all in lowercase the package has not been unpacked correctly (see "Unpacking NetRexx packages").
  4. For Java to be able to find the NetRexx classes, you must update the CLASSPATH environment variable by adding the full path and name of the NetRexxC.zip file to the CLASSPATH setting. There will often already be a CLASSPATH variable set, including a path to the standard Java classes.zip file. Specify or add the full path (disk, directories, and file specification) for NetRexxC.zip, making sure that the case of every letter is exactly right (Java is very case-sensitive). For example, the full path might be something like:
      e:\java11\lib\NetRexxC.zip 
    

    The procedure for setting the CLASSPATH variable depends on your operating system (and there may be more than one way). Here are some examples:

    If you are unsure of how to do this, check the documentation you have for installing the Java toolkit.

Note: If you add NetRexxC.zip to the CLASSPATH value then you do not need to add NetRexxR.zip; the latter contains only the NetRexx runtime classes (which are provided separately for people who don't want to run the NetRexx compiler). These runtime classes are also included in NetRexxC.zip. Whichever zip is used, the NetRexx runtime classes can be referred to from Java or NetRexx as being in the 'netrexx.lang' package. For example, a string might be of class 'netrexx.lang.Rexx'.

Checking your installation is correct

To check installation, change directory to the Java 'bin' directory, then (being very careful to get the case of letters correct):

With the sample scripts provided (NetRexxC.cmd or NetRexxC.bat), or the equivalent in the scripting language of your choice, the steps above can be combined into a simple single command:

  NetRexxC -run hello

This package also includes a trivial 'nrc.cmd' and matching 'nrc.bat' file that simply passes on its arguments to NetRexxC; 'nrc' is just a shorter name that saves keystrokes, so for the last example you could type:

  nrc -run hello

Note that scripts may be case-sensitive; unless running the OS/2 Rexx script, you will probably have to spell the name of the program exactly as it appears in the filename.

You could also edit the nrc.cmd or nrc.bat and add your favourite 'default' NetRexxC options there (if you do this, keep a backup copy, so that if you install a new version of the NetRexx package you won't overwrite your changes).

Installing NetRexx for use with Visual J++

(Many thanks to Bill Potvin and Bernhard Hurzeler for the details in this and the following section.)

  1. Copy the following file into the [java_root]\Lib directory:
      NetRexxC.zip 
    

    For example, if [java_root] is "E:\Java":

      C:\>copy NetRexxC.zip E:\Java\Lib
    
  2. Similarly, copy the nrc.bat and NetRexxC.bat files to the [java_root]\Bin directory.
  3. Add the zip file explicitly to the CLASSPATH:
      C:\>set CLASSPATH=%CLASSPATH%;[java_root]\Lib\NetRexxC.zip;
    

    For example, if [java_root] is "E:\Java", your CLASSPATH might then look like this:

      CLASSPATH=E:\Java\Lib;E:\Java\TrustLib;E:\Java\Lib\NetRexxC.zip; 
    

    Under Windows NT 4.0 this can be done using Start, Settings, Control Panel, System, Environment tab, System Variables, and clicking on CLASSPATH.

Using NetRexx with Visual J++

  1. Use the J++ "jview" command to invoke the NetRexx translator to convert a NetRexx program (e.g., hello.nrx) into a Java program (hello.java). You must specify the "-nocompile" option to NetRexx in order to prevent it from trying to invoke the Java toolkit compiler (which isn't in the MicroSoft J++ classes).

    For example, if hello.nrx is in the current directory:

      jview COM.ibm.netrexx.process.NetRexxC hello -nocompile
    

    The result of this step should be a Java source file called "hello.java".

  2. Use the J++ "jvc" command to compile the Java source file:
      jvc hello.java
    

    The result of this step should be a Java .class file called "hello.class".

  3. Execute the class file with the J++ command "jview":
      jview hello
    

Note that all the commands above probably have to be typed exactly as shown (Java is very case-sensitive). The supplied NetRexxC.bat can be modified to work with the above commands by using 'jview' instead of the 'java' command and adding the 'jvc' step.


[ previous section | contents | next section ]

From 'nrinst.doc', version 1.122.
Copyright(c) IBM Corporation, 1996, 1997. All rights reserved. ©