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.6
    

    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.

  5. If you are running Java 1.2, and want NetRexx to use the javac compiler (which is the default) then you will also need to add the Sun tools collection to the classpath. This is usually found in a file called tools.jar in the lib directory. For example:
      set classpath=%CLASSPATH%;c:\java12\lib\tools.jar
    

    (with the path changed as appropriate) would add the tools.jar to the existing classpath in an OS/2 or Windows system.

  6. If you are running Java 1.2, you may also need to add the current directory to the classpath, for example:
      set classpath=.;%CLASSPATH%
    

    as this is no longer added automatically by the Java Virtual Machine.

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).


Using JDK1.1.5 and later

JDK 1.1.5 (and later toolkits) sometimes has a Just-In-Time compiler (JIT) that slows down rather than speeds up both the NetRexx and Java compilers: programs can take between two and three times as long to compile as compared to using JDK 1.1.4. You can measure compilation times by using (for example):

  nrc hello -time

You can turn off the JIT to measure its effect. If you are using the nrc or NetRexxC .cmd or .bat file then set the environment variable:

  SET NETREXX_JAVA=-nojit

Or specify the -nojit flag directly on the java command used to run the NetRexx compiler. Otherwise, and on some platforms, this can also usually be achieved by:

  SET JAVA_COMPILER=XXX

(You may then get a message that the 'XXX' compiler could not be found. Ignore this message.)


Installing NetRexx for use on EBCDIC systems

(Many thanks to Mark Cathcart and John Kearney for the details in this section.)

The simplest way to do this is to first install the package on a workstation, following the instructions above, then copy or FTP the files you need to the EBCDIC machine. Specifically:

In general, binary files (.class files, and .zip files containing .class files) should always be transferred as BINARY -- the same binaries run on all platforms.

For specific hints and tips for installing on OS/390, see Mark Cathcart's web site at

  http://www.s390.ibm.com/corner 

which includes a presentation that describes OS/390 Java and NetRexx installation. Setting the classpath might look like this:

  export CLASSPATH=$CLASSPATH:/u/j390/j1.1.1/lib/NetRexxC.zip

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).

    Note that some versions of the jview package do not provide a "classes.zip" file by default, but the NetRexx compiler needs this to determine information about classes that you use. If this is the case, you will get a 'class not found' error for "java.lang.Object". In this case, run the command

      clspack -auto
    

    from a MS-DOS prompt to create the classes.zip file.

    When running the NetRexx compiler, 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.148.
Copyright(c) IBM Corporation, 1996, 1998. All rights reserved. ©