Viewing and Setting Environment Variables


Viewing the Current Values of Environment Variables

  1. Start NJVM.

    See Loading NJVM .

  2. At the Server Console, enter

    envset

When you unload NJVM (java.nlm), the process deletes the Environment variables that were set using ENVSET. You can add Environment variables in the sys:\etc\java.cfg file, which is read when Java loads.

NOTE:  The file SYS:\ETC\JAVA.CFG is not required for NJVM. However, it might be convenient to create it and populate it with common environment variables.


Setting the DISPLAY Environment Variable

IMPORTANT:  It would be helpful to understand the UNIX* XWindows environment to set up the DISPLAY environment variable.

  1. Start NJVM.

    See Loading NJVM .

  2. At the Server Console, enter

    envset DISPLAY=IP_address:display

    The default value for display is 127.0.0.1:0, which is the address of the loopback interface and the default value for the display and screen you want to use.


Using the Remote Display Feature

The Remote Variable Display feature lets you export the display of any X client programs to any machine on the network running an X server. Because NetWare GUI is X based, all Java GUI applications and applets are considered X clients and are able to use the remote display feature.


Allowing Remote Access to a Server

You must configure your destination server to allow remote access. The following are two methods to authorize access of a remote X client to a local X server:


Displaying a Java Applet or Application on a Local X server

  1. Start X server at the local system.

  2. Allow the remote NetWare system to access the local X server.

    See Allowing Remote Access to a Server .

  3. At the local system, start RCONJ and log in to the NetWare server.

  4. If Java is not loaded on the NetWare server, do the following in the RCONJ window:

    1. Load Java.

    2. Enter:

      envset display=ip_address_of_local_X_server:0

    3. Start the Java applet or application.

  5. (Conditional) If Java is loaded on the NetWare server, enter the following in the RCONJ window and then start the Java applet or application.

    envset display=ip_address_of_local_X_server:0

  6. (Conditional) If you want the application to always open to the GUI screen, enter the following at the command line of the NetWare server:

    envset display=ip_address_of_local_X_server:0.0

    All Java GUI applications will now display on the remote client workstation on the GUI screen. If you do not want the application to always open to the GUI screen, remove the ".0" from the end of the IP address.

    NOTE:  The Server Console screen does not automatically switch to the GUI screen when a GUI application is opened on the remote exports or foreign IP addresses.


Setting the CWD Environment Variable

You can use the Current Working Directory (CWD) variable to run an application in a specific directory even if it is not part of a package. The CWD variable is set to the root when Java is loaded; however, you can set it to any desired directory.

  1. Start NJVM.

    See Loading NJVM .

  2. To set the CWD for all applications, enter the following at the Server Console:

    envset CWD=pathname

    For example:

    envset CWD=SYS:\MYJAVA\MYAPP

    The preferred method is to set the CWD for the current application by using the -env option. For example:

    Java -envCWD=SYS:\MYFILES MYAPP


Setting the CLASSPATH Environment Variable

A default CLASSPATH variable is set when Java loads. If the CLASSPATH variable is set incorrectly, your Java applications might not run. You can improve the performance by reducing the size of the CLASSPATH variable.

  1. Start NJVM.

    See Loading NJVM .

  2. Enter the following at the Server Console:

    envset CLASSPATH=<current CLASSPATH value>;path_to_append

    For example, entering envset could produce the following for the CLASSPATH variable:

    CLASSPATH=SYS:\JAVA\LIB;SYS:
    \JAVA\CLASSES

    To append the path sys:\myclasses to this CLASSPATH, enter

    envset CLASSPATH=SYS:\JAVA\LIB;
    SYS:\JAVA\CLASSES;SYS:\MYCLASSES

    Or substitute current_CLASSPATH_value with $CLASSPATH, as in the following:

    envset CLASSPATH=$CLASSPATH;SYS:\MYCLASSES

    The $ symbol in $CLASSPATH allows the substitution of the current value of the CLASSPATH environment variable.

The CLASSPATH variable provides a default path. The directory to this path, sys:\java\classes, is created by the install program. To use this default path, or any path inside the CLASSPATH variable, place your classes in the directory pointed to by the path.

NOTE:  The default CLASSPATH variable includes (.), which means to look in the current working directory for the application. It also includes the CWD specified with the -env option. If the CWD variable is not set correctly, the application might not run. For more information, see Setting the CWD Environment Variable .



  Previous Page: Applet and Application Tasks  Next Page: Developer's Guide