#!/bin/sh

# wrapper script to start appletviewer
# with the appropriate settings for
# Java-EAI with VRwave
#
# created: mpichler, 19970919
#
# changed: mpichler, 19970929


SYS=${SYS-`uname -s`}

# either the directory where you have installed the VRwave classes
# or directory and name of VRwave class library
VRWAVECLASSES=../../classes

# you always need VRwave's core classes and Java-EAI implementation
CLASSPATH=:.:"$VRWAVECLASSES":"$CLASSPATH"

# note: moz3_0.zip is only necessary when class Browser
# (vrml.external.Browser) is extended from netscape.plugin.Plugin
# in this case you must also include SUN's java classes prior to
# netscape's because of different security policies, uff.

# when you are using the binary distribution, you'll have to
# change the path to netscape's Java classes here,
# because the binary distribution *does* depend on class Plugin.
# All that only because of some ill example programs, argh.
mozzip=../../native/SDK/classes/moz3_0.zip

if [ -f $mozzip ]
then
  # need explicit path to Sun Java classes
  if [ ! -d "$J_HOME" ]
  then
    J_HOME=/usr/local/java
  fi
  CLASSPATH=$J_HOME/lib/classes.zip:$J_HOME/classes:$mozzip:"$CLASSPATH"
  echo assuming Browser does depend on Plugin
  echo searching JDK java classes at $J_HOME/lib/classes.zip:$J_HOME/classes
else
  echo "$mozzip not found; assuming Browser does not depend on Plugin"
  echo "if it does (e.g. binary release), set location of moz3_0.zip in this script"
  echo "or recompile VRwave source code to be independent of netscape's class Plugin"
fi

export CLASSPATH

if [ -f ../classes/vrwave.zip ]
then
  # release version
  NATIVELIBDIR=../lib/${CPU?}  # containing libgejc.so
else
  # source code (local)
  NATIVELIBDIR=../../native/${CPU?}
fi


# or you'll get no 3D scene displayed
LD_LIBRARY_PATH=$NATIVELIBDIR:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
# on HPUX:
SHLIB_PATH=$NATIVELIBDIR:$SHLIB_PATH
export SHLIB_PATH

# necessary for plug-in version only
# NPX_PLUGIN_PATH=../pilib/$SYS:$NPX_PLUGIN_PATH
# export NPX_PLUGIN_PATH

set -x
# netscape VRwaveEAI.html
appletviewer avtest.html
