> I'm a new Linux user. I used Ultrix and Solaris (with tcsh) for
> several years, but I've been using NT almost exclusively for about a
> year.

So thanks for your forbearance with my Linux inadequacies ...

> I'm using an RH5.2 box that already has a working JDK 1.1.7 and
> JSDK 1.2 installed.

By our Linux guy, who's outta town this week (@#$%^$%! spring break :-)

> (It had a $CLASSPATH which I unset.) I downloaded the preview Java2
> from one of the Blackdown mirrors to /usr/local/jdk1.2pre-v1. When I
> run .../bin/java I get

>> Error: can't find libjava.so

Weiqi Gao <[EMAIL PROTECTED]> 3/7/99 9:46:07 AM >>>
G> Take a look at the driver script in jdk1.2/bin/.java_wrapper. All
the
G> other JDK commands are actually symbolic links to this script.

Definitely the sort of data I need; thanks!

G> This script uses several environment variables, some of which you
G> might have set for use by jdk117_v1a.

Unfortunately, I don't see what: my environment (set > junk) and
.java-wrapper are attached.

Note that the nasty $PATH is not my doing !-) Can anyone tell me where
I can edit this thing (it's set at startup)? More about pathing below.

Kevin Ryan <[EMAIL PROTECTED]> 3/7/99 10:53:07 AM >>>
R> (disclaimer:  haven't used Java2 on Linux yet)
R> Add that dir to your LD_LIBRARY_PATH env var setting?

Unfortunately, apparently not: I didn't have one set, so I did

> export LD_LIBRARY_PATH=/usr/local/jdk1.2pre-v1/jre/lib/i386

to no avail.

G> You also need to change your $PATH so that it points to the
G> jdk1.2/bin rather than the jdk117_v1a/bin.

I'll go back to that below. However that's not the cause of this
problem:

Michael Shoffner <[EMAIL PROTECTED]> 3/7/99 4:28:46 AM >>>
S> You appear to have to be in jdk1.2 directory:

S> [m@syzygy jdk1.2]$ bin/java -version
S> java version "1.2"
S> Classic VM (build Linux_JDK_1.2_pre-release-v1, native threads,
sunwjit)
S> [m@syzygy jdk1.2]$ 

Works for me, too. If I'm in /usr/local/jdk1.2pre-v1/bin and do

> java

I get the error, but if in /usr/local/jdk1.2pre-v1

> bin/java

gets the help output.

S> I'm sure there's some way to hack the wrapper script, but I'm not
S> capable of seeing it at this hour...

Any suggestions? And, if I may, can I expand my request to be

?> How can I set things up on the Linux box to make use of both 1.1.7
?> and 1.2 most painless?

My project has 

* a backend (which I expanded out of Mr Shoffner's excellent Forum
  series (in several 1998 JavaWorld articles)) for which I'd like to
  use 1.2

* a frontend applet which another group started in 1.2, encountered
  several major problems (notably with browsers and the Plug-in), and
  which another guy is now cleaning up and porting back to 1.1.7

So we'd like to run both JDKs with least difficulty. The way I solved
this
in NT was to use the Emacs JDE (Kinnucan is God !-), and use separate
project files for 1.1.7 and 1.2. However, Emacs is not yet setup on
the Linux box (my next challenge), and, in any case, other group
members are not yet members of the Emacs cult :-)

The easiest alternate means I can see is

- take all the Java stuff out of the environment (esp $PATH,
  $CLASSPATH)

- make shell scripts (or aliases) for the JDK tools (e.g. "java117",
  "javac12") to call the tools with classpath etc on the commandline

but I'm no Linuxen (yet, anyway :-). (For that matter I really oughta
get bash setup on NT.) So I'd appreciate your suggestions on how to do
this, as well as any questions or comments you may have.

TIA, [EMAIL PROTECTED] 

environment

#!/bin/sh

#
# @(#)java_wrapper_linux.sh     1.4 99/01/02
#
# Copyright 1994-1998 by Sun Microsystems, Inc.,
# 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
# All rights reserved.
#
# This software is the confidential and proprietary information
# of Sun Microsystems, Inc. ("Confidential Information").  You
# shall not disclose such Confidential Information and shall use
# it only in accordance with the terms of the license agreement
# you entered into with Sun.
#

PRG=$0
progname=`basename $0`
case "`uname -m`" in
    i[3-6]86)
        proc=i386
        ;;
    sparc*)
        proc=sparc
        ;;
    *)
        proc="`uname -m`"
        ;;
esac

# Resolve symlinks. See 4152645.
while [ -h "$PRG" ]; do
    ls=`/bin/ls -ld "$PRG"`
    link=`/usr/bin/expr "$ls" : '.*-> \(.*\)$'`
    if /usr/bin/expr "$link" : '/' > /dev/null; then
        PRG="$link"
    else
        PRG="`/usr/bin/dirname $PRG`/$link"
    fi
done

PPC_JAVA_HOME=/usr/local/jdk/cvs_1.2/jdk1.2/build/linux
export PPC_JAVA_HOME

APPHOME=`dirname "$PRG"`
APPHOME=`dirname "$APPHOME"`
export APPHOME
JREHOME=$APPHOME/jre

# Where is JRE?
unset jre
if [ -f "${JREHOME}/lib/${proc}/libjava.so" ]; then
    jre="${JREHOME}"
fi
if [ -f "${APPHOME}/lib/${proc}/libjava.so" ]; then
    jre="${APPHOME}"
fi
if [ "x${jre}" = "x" ]; then
    echo "Error: can't find libjava.so."
    exit 1
fi

# Select vm type (if classic vm, also select thread type).
unset vmtype
unset ttype
DEFAULT_THREADS_FLAG=native
if [ "x$1" = "x-hotspot" ]; then
    vmtype=hotspot
    ttype=native_threads
    shift 1
else
    if [ "x$1" = "x-classic" ]; then
        vmtype=classic
        ttype=${DEFAULT_THREADS_FLAG}_threads
        shift 1
    else
        if [ "x$1" = "x-green" ]; then
            vmtype=classic
            ttype=green_threads
            shift 1
        else
            if [ "x$1" = "x-native" ]; then
                vmtype=classic
                ttype=native_threads
                shift 1
            else 
                if [ -d ${jre}/lib/${proc}/hotspot ]; then
                    vmtype=hotspot
                    ttype=native_threads
                else
                    vmtype=classic
                    if [ ${THREADS_FLAG:-${DEFAULT_THREADS_FLAG}} = native ]
                    then 
                        ttype=native_threads
                    else
                        ttype=green_threads
                    fi
                fi
            fi
        fi
    fi
fi

# Special handling for classic VM.
if [ "${vmtype}" = "classic" ]; then
    # fix for bug 4032715
#    if [ ${ttype} = green_threads ] ; then 
        LD_BIND_NOW=yes
        export LD_BIND_NOW
#    fi
    # For internal use by classic VM.
    _JVM_THREADS_TYPE="${ttype}"
    export _JVM_THREADS_TYPE
fi

# Set LD_LIBRARY_PATH for hotspot VM.
j=`$jre/bin/realpath $jre`
ld="${j}/lib/${proc}/${ttype}:${j}/lib/${proc}/${vmtype}:${j}/lib/${proc}"
if [ -z "$LD_LIBRARY_PATH" ]; then
    LD_LIBRARY_PATH="$ld"
else
    LD_LIBRARY_PATH="$ld:$LD_LIBRARY_PATH"
fi
export LD_LIBRARY_PATH

prog="$APPHOME/bin/${proc}/${ttype}/${progname}"

# Run.
if [ -x "$prog" ]
then
    exec $DEBUG_PROG "$prog" "$@"
else
    echo >&2 "$progname was not found in ${prog}"
    exit 1
fi

Reply via email to