  JWS for LinuX
  Mike Gaertner <mg@genyosha.in-chemnitz.de>
  Version 1.2-en 08.09.1996

  Using Java WorkShop (JWS) for Solaris/intel on Linux

  1.  Preface

  In the past few months many PC-magazines have articles about java and
  ship with a CD containing applets and demo-programs for java. On some
  CDs you can find a beta-version of the "Java Workshop", JWS is a
  Develop Kit, (writing in Java) for Java, include a Editor, Debuger,
  and Portofolie/Project-Manager.

  instructions on how to install this JWS under Linux. Only WinNT,
  Windows95, SunSolaris Sparc or SunSolars Intel are mentioned in the
  documentation coming with the CDs.

  As I didn't found any description on this on the net, I did it myself
  and wrote this mini-HOWTO.

  2.  Requisites

  Please read the Java-HOWTO for general information about Java under
  Linux and how to install the nesassary JDK. For the rest of the mini-
  HOWTO it is assumed that you have

  1. the JDK version 1.0 (or better) installed

  2. X11R6 (e.g. XFree86 3.1.2 or higher)

  3. a CD with JWS in your CD-drive.

  3.  Installation

  First you have to decide where to install the JWS. As JWS is not part
  of a distribution, it may be a good idea to install it in the
  "/usr/local"-hierarchy.

  Set environment-variable "JWS_HOME" to point to the directory of your
  choice and set it permanently in the startup-file of you shell.

  For example if you use "bash", the startup-files are "/etc/profile" or
  " /.bash_profile" and the necessary entries would be

  export JWS_HOME="/usr/local/JWS"
  export JAVA_HOME="/usr/local/lib/java"

  The second entry points to the directory where java is installed on
  your system. If it is not already set, add it to the startup-file,
  too.

  On most CDs relating to java you can find the JWS in a sub-directory
  named workshop. Look for the file inteltar.z which is the version of
  the JWS for SunSolars/i386.

  This file is a compressed archive which can be unpacked with

  tar  -xvzf inteltar.z  -C ${JWS_HOME}

  After you have issued this command, you will find the following sub-
  directories in ${JWS_HOME}:

  classes, examples, intel-S2, lib, solaris

  The commands shown below will delete superfluous files from the
  freshly unpacked JWS and create the necessary links to the already
  installed java-binaries. You can use them verbatim (e.g. via cut&paste
  on the command-line).

  ln  -s ${JWS_HOME}/classes  ${JAVA_HOME}/lib/classes
  rm  ${JWS_HOME}/intel-S2/bin/i386/*
  rmdir ${JWS_HOME}/intel-S2/bin/i386
  ln -s ${JAVA_HOME}/bin/i586 ${JWS_HOME}/intel-S2/bin/i586
  ln -s ${JAVA_HOME}/bin/i486 ${JWS_HOME}/intel-S2/bin/i486
  ln -s ${JAVA_HOME}/bin/i386 ${JWS_HOME}/intel-S2/bin/i386

  The shell-script for starting JWS is ${JWS_HOME}/intel-S2/bin/jws.
  Because I modified it heavily, it's appended at the end of this mini-
  HOWTO.

  Furthermore you have to change line 8 in ${JWS_HOME}/solaris/bin/javac
  so it reads:

  if [ -x ${_SS_JDK_BIN}/bin/`/bin/uname -m`/javac ]

  Hey, you are already done! End of the show.

  Only a last hint: if you create a new project with the JWS you must
  add ${JAVA_HOME}/lib/classes.zip to the environment-varibable
  "CLASSPATH".

  4.  Acknowledgements

  Thanks to Winfried Truemper <truemper@ElFi.MI.Uni-Koeln.DE> for
  translating this mini-HOWTO.

  5.  Appendix

  The modified shell-script ${JWS_HOME}/intel-S2/bin/jws is listed
  below.

  ---8<-----8<--- cut here ---8<-----8<----
  #!/bin/sh
  #
  # @(#)jws       1.64 96/05/02
  #
  # Copyright (c) 1994 Sun Microsystems, Inc. All Rights Reserved.
  #
  # Permission to use, copy, modify, and distribute this software
  # and its documentation for NON-COMMERCIAL purposes and without
  # fee is hereby granted provided that this copyright notice
  # appears in all copies. Please refer to the file "copyright.html"
  # for further important copyright and licensing information.
  #
  # SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  # THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  # TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  # PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
  # ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  # DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  #

  #
  # Determine JWS_HOME
  #
  # edit by Mike Gaertner 06.09.1996 mg@genyosha.in-chemnitz.de
  # Set environment-variable "JWS_HOME" and "JAVA_HOME" !
  #
  _SS_JDK_BIN=${JAVA_HOME}
  _SS_JWS_HOME=${JWS_HOME}
  #
  _SS_JDK_HOME=$_SS_JDK_BIN
  #
  RUNCLASSPATH="$_SS_JDK_BIN/lib/classes.zip:$_SS_JDK_BIN/lib/classes"
  #
  NCLASSPATH="$_SS_JDK_BIN/lib/classes"
  export LD_LIBRARY_PATH
  LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$J_HOME/lib/`arch`"

  if [ -z "$_SS_JWS_HOME" ] ; then
      _SS_JWS_HOME=`dirname $0`
      _SS_JWS_HOME=`cd $_SS_JWS_HOME/../.. ; pwd`
      echo "_SS_JWS_HOME is set to $_SS_JWS_HOME"
  fi

  if [ ! -d "$_SS_JWS_HOME" ] ; then
      echo "Invalid _SS_JWS_HOME: $_SS_JWS_HOME" 1>&2
      exit 1
  fi

  if [ ! -r "$_SS_JWS_HOME/lib/properties" ] ; then
      echo "Invalid _SS_JWS_HOME: $_SS_JWS_HOME/lib/properties" 1>&2
      exit 1
  fi

  # Since JDK executables are installed into JWS, _SS_JDK_BIN is set to
  # JWS/${VARIANT}/bin by default.  It might also point to a build or
  # archive area.
  if [ ! "${_SS_JDK_BIN}" ]
  then
    if [ ${_SS_JDK_HOME} ]
    then
      _SS_JDK_BIN=${_SS_JDK_HOME}
    else
      _SS_JDK_BIN=$_SS_JWS_HOME/${VARIANT}
    fi
  else
    # could be either an install JWS dir or JDK bin
    if [ -d ${_SS_JDK_BIN}/build ]
    then
      _SS_JDK_BIN=${_SS_JDK_BIN}/build
    elif [ -d ${_SS_JDK_BIN}/${VARIANT} ]
    then
      _SS_JDK_BIN=${_SS_JDK_BIN}/${VARIANT}
    fi
  fi

  # needs to be exported, because it is referenced by JWS builder
  export  _SS_JDK_BIN

  # assert: _SS_JDK_BIN points to the parent of lib
  if [ ! -d ${_SS_JDK_BIN}/bin ]
  then
    echo " By convention, _SS_JDK_BIN must have a bin subdirectory"
    echo " _SS_JDK_BIN:  ${_SS_JDK_BIN}"
    echo " ${_SS_JDK_BIN}/bin does not exits"
    exit
  fi

  # Given the root of a JDK tree, set _SS_JDK_HOME to the parent directory
  #       of bin,classes and lib
  #
  # There are three types of JDK directories.
  #       * build directories are identical to the JDK directory provide
  #               by JavaSoft.  No a stable area.  Iteam members are
  #               discouraged from relying on this area.
  #       * archive directories simply copy all content from the build
  #               directory that is to be shipped to the user.  On win32,
  #               redist is moved to bin.
  #       * installation directory - Since the contains of the JDK bin
  #               directories have been moved to JWS, there is no bin dir
  #               in the JDK tree.
  #   jsk, 4-15-96

  if [ ! "${_SS_JDK_HOME}" ]
  then
    _SS_JDK_HOME=$_SS_JWS_HOME/../JDK
  else
    if [ -d ${_SS_JDK_HOME}/build  ]
    then
      export _SS_JDK_HOME=${_SS_JDK_HOME}/build
    fi
  fi

  # assert: _SS_JDK_HOME points to the parent of classes
  if [ ! -d ${_SS_JDK_HOME}/lib/classes ]
  then
    echo " By convention, _SS_JDK_HOME must have a classes subdirectory"
    echo " _SS_JDK_HOME:  ${_SS_JDK_HOME}"
    echo " ${_SS_JDK_HOME}/lib does not exits"
    exit
  fi

  # assert: _SS_JDK_HOME points to the parent of lib
  if [ ! -d ${_SS_JDK_HOME}/lib ]
  then
    echo " By convention, _SS_JDK_HOME must have a lib subdirectory"
    echo " _SS_JDK_HOME:  ${_SS_JDK_HOME}"
    echo " ${_SS_JDK_HOME}/lib does not exits"
    exit
  fi

  if [ `/bin/uname -m` = "i386" ] ; then
    ARCH='i386'
  elif [  `/bin/uname -m` = "i486" ] ; then
    ARCH='i486'
  elif [  `/bin/uname -m` = "i586" ] ; then
    ARCH='i586'
  fi

  #
  # Set Paths
  #
  #
  # Create .jws directory
  #

  # backwards compatibility
  if [ -d "$HOME/.jde" ] ; then
      if [ ! -d "$HOME/.jws" ] ; then
          echo "Moving $HOME/.jde to $HOME/.jws"
          mv $HOME/.jde $HOME/.jws
      fi
  fi
  if [ ! -d "$HOME/.jws" ] ; then
      echo "Creating $HOME/.jws directory"
      mkdir -p $HOME/.jws
  fi

  #
  # Parse arguments
  #  the -debug option is assumed to have a value associated with it.
  #  transform '-debug <file>' to '-debug -Djws.startup.props=<file>'

  prog=java
  debug_opts="";
  opts="";
  while [ $# -ne 0 ]; do
     case "$1" in
      -debug) prog=java_g; debug_opts="-debug"; debug_prop="-Ddebug.browser=yes" ;;
      -*) opts="$opts $1" ;;
      *)  args="$args $1" ;;
     esac
     shift;
  done

  #
  # Select a java interpreter
  #

  if [ -x "${_SS_JDK_BIN}/bin/$prog" ] ; then
      JAVA="${_SS_JDK_BIN}/bin/$prog"
  else
      JAVA=$prog
  fi

  #
  # Add WWW_HOME option
  #
  if [ ! -z "$WWW_HOME" ] ; then
      opts="$opts -Dwww.home=$WWW_HOME"
  fi

  JWSLOG=${JWSLOG:-$HOME/.jws/weblog}
  export JWSLOG

  exec $JAVA $debug_opts -classpath $RUNCLASSPATH \
  -Djws.home=$_SS_JWS_HOME -Dhotjava.home=$_SS_JWS_HOME \
  -Djws.bin=$JWS_BIN -Djdk.bin=${_SS_JDK_BIN}/bin \
  -Djws.ut.user=$USER "-Djws.ut.platform=\"`uname -srm`\"" \
  -Djws.build.classes=$NCLASSPATH $debug_prop $opts sun.jws.Main $args

  ---8<-----8<--- cut here ---8<-----8<----

