aboutsummaryrefslogtreecommitdiff
path: root/libjava/prims.cc
diff options
context:
space:
mode:
authorAnthony Green <green@redhat.com>2000-08-26 19:25:13 +0000
committerAnthony Green <green@gcc.gnu.org>2000-08-26 19:25:13 +0000
commit6aaeb97551dcfaa5dbcca802782ec42dd7b4cf43 (patch)
treeec60dfe7b11606b3c5c1d32bb2b29e9dd37d5be1 /libjava/prims.cc
parent14fdf4b67e8843c870c88baac0c4974b2e67bb32 (diff)
downloadgcc-6aaeb97551dcfaa5dbcca802782ec42dd7b4cf43.zip
gcc-6aaeb97551dcfaa5dbcca802782ec42dd7b4cf43.tar.gz
gcc-6aaeb97551dcfaa5dbcca802782ec42dd7b4cf43.tar.bz2
Makefile.in: Rebuilt.
2000-08-26 Anthony Green <green@redhat.com> * 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. From-SVN: r35999
Diffstat (limited to 'libjava/prims.cc')
-rw-r--r--libjava/prims.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/libjava/prims.cc b/libjava/prims.cc
index 38714b3..7766f66 100644
--- a/libjava/prims.cc
+++ b/libjava/prims.cc
@@ -47,6 +47,7 @@ details. */
#endif // DISABLE_GETENV_PROPERTIES
#include <java/lang/Class.h>
+#include <java/lang/ClassLoader.h>
#include <java/lang/Runtime.h>
#include <java/lang/String.h>
#include <java/lang/Thread.h>
@@ -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);