From ac96e9f0c156bca8ecfd01792509e39aa6f3b7ff Mon Sep 17 00:00:00 2001 From: green Date: Sat, 26 Aug 2000 19:25:13 +0000 Subject: 2000-08-26 Anthony Green * Makefile.in: Rebuilt. * Makefile.am (java/lang/ClassLoader.h): Make _Jv_RunMain a friend. * prims.cc: Include ClassLoader.h. (_Jv_RunMain): When executing jar files, classpath must be the jar file only. Lose our reference to the system ClassLoader in order to get a new one with the correct classpath. * java/lang/natSystem.cc (init_properties): When executing a jar file, only use the jar file for java.class.path. * gnu/gcj/runtime/VMClassLoader.java: Use the canonical file name for bytecode archives. * gnu/gcj/runtime/FirstThread.java: Handle case where manifest exists, but not Main-Class. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35999 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/prims.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libjava/prims.cc') diff --git a/libjava/prims.cc b/libjava/prims.cc index 38714b300d9..7766f66cec7 100644 --- a/libjava/prims.cc +++ b/libjava/prims.cc @@ -47,6 +47,7 @@ details. */ #endif // DISABLE_GETENV_PROPERTIES #include +#include #include #include #include @@ -906,6 +907,9 @@ _Jv_RunMain (const char *name, int argc, const char **argv, bool is_jar) if (is_jar) { + // name specifies a jar file. We must now extract the + // Main-Class attribute from the jar's manifest file. This is + // done by gnu.gcj.runtime.FirstThread.main. _Jv_Jar_Class_Path = strdup (name); arg_vec = JvConvertArgv (1, &_Jv_Jar_Class_Path); @@ -915,7 +919,14 @@ _Jv_RunMain (const char *name, int argc, const char **argv, bool is_jar) main_thread->start(); _Jv_ThreadWait (); + // FirstThread.main extracts the main class name and stores it + // here. class_name = gnu::gcj::runtime::FirstThread::jarMainClassName; + + // We need a new ClassLoader because the classpath must be the + // jar file only. The easiest way to do this is to lose our + // reference to the previous classloader. + java::lang::ClassLoader::system = NULL; } else class_name = JvNewStringLatin1 (name); -- cgit v1.2.1