Run the client program

If you have not refreshed or restarted the server since creating the JavaArithmetic component, refresh the server before running the client program.

Create a batch file or UNIX shell script to run the client application, then run it. The batch file or shell script configures the CLASSPATH environment variable, then runs the application using the JDK 1.4 java program included with your EAServer installation.

If necessary, you can run the client on a different machine than the server host, as long as your server uses a real host address and not localhost or 127.0.0.1.

If everything is working, the application prints the results from the invocation of the multiply method. If not, check the error text printed on the console where you ran the client, and check for error messages in the server log file.

StepsRunning the client on Windows

  1. Create a file named runclient.bat containing the commands below:

    setlocal
    call %DJC_HOME%\bin\djc-setenv.bat
    cd %DJC_HOME%\samples\tutorial\java-corba
    set CLASSPATH=%CLASSPATH%;.\client-classes
    %JAVA_HOME%\jre\bin\java com.sybase.easerver.tutorials.java.client.Arith %* 
    
    
  2. Run the client by running the batch file and specifying the server’s IIOP URL on the command line, for example:

    set DJC_HOME=D:\Sybase\eas60
    runclient iiop://myhost:2000
    

StepsRunning the client on UNIX

  1. Create a file named runclient containing the commands below:

    #!/bin/sh 
    . $DJC_HOME/bin/djc-setenv.sh
    cd $DJC_HOME/samples/tutorial/java-corba
    CLASSPATH=$CLASSPATH:./client-classes export CLASSPATH
    $JAVA_HOME/jre/bin/java com.sybase.easerver.tutorials.java.client.Arith $*
    
    
  2. Change the file permissions to allow the script to be executed. For example:

    chmod 777 runclient
    
  3. Run the client by running the batch file and specifying the server’s IIOP URL on the command line, for example:

    setenv DJC_HOME /opt/Sybase/eas60
    runclient iiop://myhost:2000