java/lang/Object
Derek L Davies
ddavies at world.std.com
Thu Jan 13 12:08:47 PST 2000
This is probably something really stupid but I'm flapping trying to
figure it out. I've writen a unit test for the addition of GetEnv to
the invokation interface. When I run it I get:
0.:/home/ddavies/src/kaffe-1.0.5/test/regression/native>./run.sh
Couldn't find or load essential class `java/lang/Object' java.lang.NoClassDefFoundError java/lang/Object
Aborted (core dumped)
0.:/home/ddavies/src/kaffe-1.0.5/test/regression/native>
I've tried various manipulations of CLASSPATH. Any ideas on what I'm
missing would be of great help. Here's the code:
+++ run.sh (bastardized `kaffe`):
#! /bin/sh
#
# Driver script for Kaffe.
# This script invokes the "Kaffe" executable after modifying
# CLASSPATH and LD_LIBRARY_PATH as needed.
#
# We prepend kaffe's lib directory to LD_LIBRARY_PATH.
#
# KAFFELIBRARYPATH is defined to kaffe's native lib directory
# (lib/kaffe) if not set.
#
# The effective CLASSPATH is made up of four parts, which
# are composed in the following order:
#
# 1. a user-specified CLASSPATH or .
# 2. Klasses.jar in $datadir/kaffe
# 3. Kaffe extensions jar files in $datadir/kaffe
# 4. kjc.jar in $datadir/kaffe
# 5. classes.zip in $datadir/kaffe iff it exists.
#
# Note that as the last thing we slurp in the files $datadir/kafferc
# and $HOME/.kafferc (in that order) if they exist. This allows site
# and user specific JAR files to be automatically added to CLASSPATH.
#
# If KAFFE_DEBUG is set to either gdb or emacs, a debugging session
# will be started. gdb will be started so that the current working
# directory and the argument list are correct.
prefix="/home/ddavies"
exec_prefix="${prefix}"
PATHSEP=':'
DIRSEP='/'
: ${KAFFE_LIBDIR="${exec_prefix}/lib"}
: ${KAFFE_LIBEXECDIR="${exec_prefix}/libexec"}
: ${KAFFE_CLASSDIR="${prefix}/share/kaffe"}
: ${KAFFE_NATIVE_LIBRARY_DIR="${exec_prefix}/lib/kaffe"}
: ${KAFFE_OLD_NATIVE_LIBRARY_DIR="$KAFFE_CLASSDIR/lib/i386-linux"}
if test x"${KAFFEHOME+set}"x != x"set"x; then
KAFFEHOME="/home/ddavies"
fi
export KAFFEHOME
CLASSPATH="${CLASSPATH-.}"
for f in Klasses.jar comm.jar pjava.jar servlet.jar tools.jar microsoft.jar kjc.jar rmi.jar; do
if test -f "$KAFFE_CLASSDIR/$f"; then
CLASSPATH="$CLASSPATH$PATHSEP$KAFFE_CLASSDIR/$f"
fi
done
if test -f "$KAFFE_CLASSDIR/classes.zip"; then
CLASSPATH="$CLASSPATH$PATHSEP$KAFFE_CLASSDIR/classes.zip"
fi
case "$DIRSEP" in /) ;;
*) CLASSPATH=`echo "$CLASSPATH" | sed 's,/,'"$DIRSEP"',g'` ;;
esac
export CLASSPATH
KAFFELIBRARYPATH="$KAFFE_NATIVE_LIBRARY_DIR$PATHSEP$KAFFE_LIBDIR"${KAFFELIBRARYPATH+"$PATHSEP$KAFFELIBRARYPATH"}${LD_LIBRARY_PATH+"$PATHSEP${LD_LIBRARY_PATH}"}
if test -d "$KAFFE_OLD_NATIVE_LIBRARY_DIR"; then
KAFFELIBRARYPATH="$KAFFELIBRARYPATH$PATHSEP$KAFFE_OLD_NATIVE_LIBRARY_DIR"
fi
export KAFFELIBRARYPATH
LD_LIBRARY_PATH="$KAFFE_LIBDIR"${LD_LIBRARY_PATH+"$PATHSEP$LD_LIBRARY_PATH"}
export LD_LIBRARY_PATH
PATH="$PATH:$KAFFE_LIBDIR" # MS-Windows DLLs must be in the PATH
export PATH
# Slurp in system and user specific scripts
if [ -f "${prefix}/share/kaffe/kafferc" ]; then
. ${prefix}/share/kaffe/kafferc
fi
if [ -f "${HOME}/.kafferc" ]; then
. "${HOME}/.kafferc"
fi
if test x"${KAFFE_DEBUG+set}"x != x"set"x; then
exec ./testGetEnv
else
case `"$KAFFE_DEBUG" --version </dev/null 2>/dev/null` in
*"GDB"* | *"GNU gdb"*)
# start command-line gdb within the correct working directory,
# and set up the specified argument list
{
echo "shell rm -f /tmp/.gdbinit.$$"
echo "cd `pwd`"
echo "set args $*"
} >/tmp/.gdbinit.$$
exec "$KAFFE_DEBUG" -command /tmp/.gdbinit.$$ $KAFFE_LIBEXECDIR/Kaffe
rm -f /tmp/.gdbinit.$$;;
DDD*)
# Tell DDD to start gdb within the correct working directory,
# and set up the specified argument list
{
echo "shell rm -f /tmp/.gdbinit.$$"
echo "cd `pwd`"
echo "set args $*"
} >/tmp/.gdbinit.$$
exec "$KAFFE_DEBUG" --debugger "${GDB-gdb} -command /tmp/.gdbinit.$$" \
$KAFFE_LIBEXECDIR/Kaffe
rm -f /tmp/.gdbinit.$$;;
"GNU Emacs"*)
# start gdb within GNU Emacs, move into the current working
# directory and set up the specified argument list
exec "$KAFFE_DEBUG" -eval "(progn (gdb \"gdb $KAFFE_LIBEXECDIR/Kaffe\") (gud-call \"cd `pwd`\") (gud-call \"set args $*\"))";;
XEmacs*)
# start gdb within XEmacs, move into the current working
# directory and set up the specified argument list
exec "$KAFFE_DEBUG" -eval "(progn (gdb \"$KAFFE_LIBEXECDIR/Kaffe\") (gdb-call \"cd `pwd`\") (gdb-call \"set args $*\"))";;
*) echo you must set KAFFE_DEBUG to either emacs or gdb >&2;;
esac
fi
exit 1
--- run.sh
+++ Makefile.am (stolen from kaffe/kaffe/Makefile.am)
# Makefile.in for kaffe - a Java(tm) compatible virtual machine wrapper.
#
# Copyright (c) 1996, 1997, 1998, 1999
# Transvirtual Technologies, Inc. All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution
# of this file.
libexec_PROGRAMS = testGetEnv
INCLUDES = -I../kaffevm -I$(srcdir)/../kaffevm -I$(top_srcdir)/libltdl
testGetEnv_SOURCES = testGetEnv.c
LIBKAFFEVM = ../../../kaffe/kaffevm/libkaffevm.la
testGetEnv_LDFLAGS = -export-dynamic
testGetEnv_LDADD = $(DLOPEN_JAVA_LIBS) $(LIBKAFFEVM) $(KAFFE_LIBS)
testGetEnv_DEPENDENCIES = $(LIBKAFFEVM) $(JAVA_LIBS)
--- Makefile.am
+++ testGetEnv.c (the unit test itself)
#include <jni.h>
#include <system.h>
int main(int argc, char* argv[])
{
JavaVM* vm;
JNIEnv* env;
JNIEnv* test_env;
JavaVMInitArgs vm_args;
char classpath[1024];
int exit_code = 0;
vm_args.version = JNI_VERSION_1_1;
JNI_GetDefaultJavaVMInitArgs(&vm_args);
sprintf(classpath, "%s%s.", vm_args.classpath, path_separator);
vm_args.classpath = classpath;
if (JNI_CreateJavaVM(&vm, &env, &vm_args) != JNI_OK)
{
fprintf(stderr, "ERROR Couldn't create Java VM for GetEnv test.\n");
exit(0x01);
}
if ((*vm)->GetEnv(vm, (void**)&test_env, 0xFFFFFFFF) != JNI_EVERSION)
{
fprintf(stderr, "FAILED JNI_EVERSION GetEnv test.\n");
exit_code = 0x02;
}
if ((*vm)->GetEnv(vm, (void**)&test_env, JNI_VERSION_1_1) != JNI_OK)
{
fprintf(stderr, "FAILED JNI_VERSION_1_1 GetEnv test.\n");
exit_code |= 0x04;
}
if ((*vm)->GetEnv(vm, (void**)&test_env, JNI_VERSION_1_2) != JNI_OK)
{
fprintf(stderr, "FAILED JNI_VERSION_1_2 GetEnv test.\n");
exit_code |= 0x08;
}
if ((*vm)->DetachCurrentThread(vm) != JNI_OK)
{
fprintf(stderr, "ERROR Couldn't detach current thread.\n");
(*vm)->DestroyJavaVM(vm);
exit(exit_code |= 0x10);
}
if ((*vm)->GetEnv(vm, (void**)&test_env, JNI_VERSION_1_1) != JNI_EDETACHED)
{
fprintf(stderr, "FAILED JNI_EDETACHED GetEnv test.\n");
exit_code |= 0x20;
}
(*vm)->DestroyJavaVM(vm);
exit(exit_code);
}
/* End of testGetEnv.c */
--- testGetEnv.c
More information about the kaffe
mailing list