Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Feb 2000 10:44:40 +0100
From:      Ernst de Haan <ernst@jollem.com>
To:        "Koster, K.J." <K.J.Koster@research.kpn.com>
Cc:        "'FreeBSD Java mailing list'" <freebsd-java@freebsd.org>
Subject:   Re: mess after installing some java jdks
Message-ID:  <38A3DA08.2A944D9F@jollem.com>
References:  <59063B5B4D98D311BC0D0001FA7E452201313801@l04.research.kpn.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------0C72FAD502182D7DBAB541A3
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hey,

I doubt you _have_ to switch back to JDK 1.1, but in case you do, maybe
you can write a few scripts that will switch between JDK 1.1 and JDK 1.2.
As an example, I've attached the scripts I use:

   * init-classpath : Initializes JAVA_HOME and CLASSPATH
   * init-path      : Initializes PATH (called from .profile as well)
   * jdk11          : Sets the environment for JDK 1.1
   * jdk12          : Sets the environment for JDK 1.2

Let me know if this is of any help. You should probably source the
appropriate script, like this:

   bash-2.03$ pwd
   /home/ernst
   bash-2.03$ echo ~/bin/*
   init-classpath init-path jdk11 jdk12
   bash-2.03$ . jdk11
   >> Initializing Java libraries for JDK 1.1
      -- Java Development Kit 1.1
      -- Java Foundation Classes 1.1.1
      -- Java Servlet Development Kit 2.0
      -- JavaBeans Activation Framework 1.0.1
   WARNING: MySQL mm JDBC Driver 2.0pre4 for JDBC 1.0:
/usr/local/share/java/classes/mm/mm.mysql.jdbc-2.0pre4/mysql_1_uncomp.jar
not found
      -- ObjectStore PSE Pro 3.0 (runtime)
      -- ObjectStore PSE Pro 3.0 (tools)
   WARNING: Custom Java libraries: /home/ernst/java/lib not found

There's still a few minor bugs in the scripts (it currently only works for
zip and jar files), but I'm working on that. And an improvement I want to
make is define all the libraries in a separate file (.javalibs or so).


Ernst


"Koster, K.J." wrote:
> 
> > >
> > > ~> locate libhpi.so
> > >
> > /usr/ports/java/linux-jdk-1.2/work/jdk1.2/jre/lib/i386/green_t
> hreads/libhpi.so
> > >
> > /usr/ports/java/linux-jdk-1.2/work/jdk1.2/jre/lib/i386/native_
> threads/libhpi.so
> > > /usr/local/jdk1.2/jre/lib/i386/green_threads/libhpi.so
> > > /usr/local/jdk1.2/jre/lib/i386/native_threads/libhpi.so
> > >
> locate is not reliable in this particular case, since its information may be
> quite old, depending on when /etc/daily last ran. Try looking with "ls" :-)
> 
> Also: I have 2 JDK, but I always set the paths in my makefiles. The PATH
> environment does not have the JDK in it, to avoid confusion.
> 
>     Kees Jan
> 
> ==============================================
>  You are only young once,
>       but you can stay immature all your life
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-java" in the body of the message
--------------0C72FAD502182D7DBAB541A3
Content-Type: text/plain; charset=us-ascii;
 name="init-classpath"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="init-classpath"

#!/bin/sh

#
# init-java-libs.sh
#
# Initialize the CLASSPATH that applies to either JDK 1.1 or JDK 1.2
#
# This shell script should be called after the following environment
# variable has been initialized:
#
#    JAVA_VERSION      -- Either JAVA_1_1 or JAVA_1_2
#


#-----------------------------------------------------------------------------
# Settings
# Customize this section for your particular configuration.

JAVA_CLASSES_HOME=/usr/local/share/java/classes
JDK_1_1_HOME=/usr/local/jdk1.1.8
JDK_1_2_HOME=/usr/local/linux-jdk1.2.2
CUSTOM_JAVA_LIBS=${HOME}/java/lib


#-----------------------------------------------------------------------------
# Function definitions

add ( )
{
	if [ "${title}" = "" ]
	then
		echo "WARNING: location and title must be specified"
		return
        elif [ "${location}" = "" ]
	then
		echo "WARNING: location must be specified"
        elif [ "${title}" = "" ]
	then
		echo "WARNING: title must be specified"
        fi

	if [ ! -f ${location} ]
	then
		echo "WARNING: $title: $location not found"
	else
		echo "   -- $title"
		CLASSPATH=$CLASSPATH:$location
	fi
}

#-----------------------------------------------------------------------------
# Check the preconditions

if [ ""${JAVA_VERSION} = "" ]
then
	echo "ERROR: JAVA_VERSION is not set"
	exit 1
fi

case $JAVA_VERSION in

	"JAVA_1_1")
		echo ">> Initializing Java libraries for JDK 1.1"
		;;

	"JAVA_1_2")
		echo ">> Initializing Java libraries for JDK 1.2"
		;;

	*)
		echo "ERROR: Variable JAVA_VERSION should be either JAVA_1_1 or JAVA_1_2"
		exit 1
		;;
esac


#-----------------------------------------------------------------------------
# Check the settings

if [ ! -d ${JAVA_CLASSES_HOME} ]
then
	echo "Directory ${JAVA_CLASSES_HOME} not found"
	exit 2
fi

if [ ! -d ${JDK_1_1_HOME} ]
then
	echo "Directory ${JAVA_CLASSES_HOME} not found"
	exit 2
fi

if [ ! -d ${JDK_1_2_HOME} ]
then
	echo "Directory ${JAVA_CLASSES_HOME} not found"
	exit 2
fi


#-----------------------------------------------------------------------------
# Set the JAVA_HOME variable

if [ ${JAVA_VERSION} = "JAVA_1_1" ]
then
	JAVA_HOME=${JDK_1_1_HOME}
elif [ ${JAVA_VERSION} = "JAVA_1_2" ]
then
	JAVA_HOME=${JDK_1_2_HOME}
fi
export JAVA_HOME


#-----------------------------------------------------------------------------
# Java Development Kit

CLASSPATH=""
if [ ${JAVA_VERSION} = "JAVA_1_1" ]
then
	title="Java Development Kit 1.1"
	location="$JAVA_HOME/lib/classes.zip"
	add
elif [ ${JAVA_VERSION} = "JAVA_1_2" ]
then
	title="Java Development Kit 1.2"
	location="$JAVA_HOME/jre/lib/rt.jar"
	add
fi
export CLASSPATH


#-----------------------------------------------------------------------------
# Java Foundation Classes 1.1.1

# NOTE: JFC is integrated in JDK 1.2
if [ ${JAVA_VERSION} = "JAVA_1_1" ]
then
	title="Java Foundation Classes 1.1.1"
	location=$JAVA_CLASSES_HOME/jfc-1.1.1/swingall.jar
	add
fi


#-----------------------------------------------------------------------------
# Java Servlet Development Kit 2.0


title="Java Servlet Development Kit 2.0"
location=$JAVA_CLASSES_HOME/jsdk.jar
add


#-----------------------------------------------------------------------------
# JavaBeans Activation Framework
# PENDING: Isn't this already included in JDK 1.2 ?

title="JavaBeans Activation Framework 1.0.1"
location=$JAVA_CLASSES_HOME/activation.jar
add


#-----------------------------------------------------------------------------
# MySQL mm JDBC drivers

if [ $JAVA_VERSION = "JAVA_1_1" ]
then
	# Use the JDBC 1.0 driver for JDK 1.1
	title="MySQL mm JDBC Driver 2.0pre4 for JDBC 1.0"
	location=$JAVA_CLASSES_HOME/mm/mm.mysql.jdbc-2.0pre4/mysql_1_uncomp.jar
	add
elif [ $JAVA_VERSION = "JAVA_1_2" ]
then
	# Use the JDBC 2.0 driver for JDK 1.2
	title="MySQL mm JDBC Driver 2.0pre4 for JDBC 2.0"
	location=$JAVA_CLASSES_HOME/mm/mm.mysql.jdbc-2.0pre4/mysql_2_uncomp.jar
	add
fi


#-----------------------------------------------------------------------------
# ObjectStore PSE Pro 6.0

title="ObjectStore PSE Pro 3.0 (runtime)"
location=$HOME/psepro/pro_g.zip
add

title="ObjectStore PSE Pro 3.0 (tools)"
location=$HOME/psepro/tools_g.zip
add


#-----------------------------------------------------------------------------
# Custom Java libraries

if [ ! ""${CUSTOM_JAVA_LIBS} = "" ]
then
	title="Custom Java libraries"
	location=$CUSTOM_JAVA_LIBS
	add
fi

--------------0C72FAD502182D7DBAB541A3
Content-Type: text/plain; charset=us-ascii;
 name="init-path"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="init-path"

#!/bin/sh

#
# init-path.sh
#
# Initializes the PATH environment variable.
#

if [ ""${HOME} = "" ]
then
	echo "ERROR: Variable HOME should be set"
	exit 1
fi

PATH=/bin\:/usr/bin\:/usr/X11R6/bin\:/usr/local/bin\:${HOME}/bin
export PATH

--------------0C72FAD502182D7DBAB541A3
Content-Type: text/plain; charset=us-ascii;
 name="jdk11"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="jdk11"

#!/bin/sh

#
# jdk11
#
# Initializes the JDK 1.1 environment
#

# Set the JDK version to 1.1
JAVA_VERSION=JAVA_1_1
export JAVA_VERSION

# Initialize the CLASSPATH
. ${HOME}/bin/init-classpath

# Set the PATH
. ${HOME}/bin/init-path
PATH=$PATH:$JAVA_HOME/bin
export PATH

--------------0C72FAD502182D7DBAB541A3
Content-Type: text/plain; charset=us-ascii;
 name="jdk12"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="jdk12"

#!/bin/sh

#
# jdk12
#
# Initializes the JDK 1.2 environment
#

# Set the JDK version to 1.2
JAVA_VERSION=JAVA_1_2
export JAVA_VERSION

# Initialize the CLASSPATH
. ${HOME}/bin/init-classpath

# Set the PATH
. ${HOME}/bin/init-path
PATH=$PATH:$JAVA_HOME/bin
export PATH

--------------0C72FAD502182D7DBAB541A3
Content-Type: text/x-vcard; charset=us-ascii;
 name="ernst.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Ernst de Haan
Content-Disposition: attachment;
 filename="ernst.vcf"

begin:vcard 
n:de Haan;Ernst
tel;fax:+31 (0)26 3645634
tel;work:+31 (0)26 3623895
x-mozilla-html:FALSE
url:http://www.znerd.demon.nl/
org:Jollem
adr:;;Rozendaalselaan 35;Velp;GLD;6881 KZ;Netherlands
version:2.1
email;internet:ernst@jollem.com
title:Java Architect
fn:Ernst de Haan
end:vcard

--------------0C72FAD502182D7DBAB541A3--



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?38A3DA08.2A944D9F>