aboutsummaryrefslogtreecommitdiff
path: root/libjava
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
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')
-rw-r--r--libjava/ChangeLog19
-rw-r--r--libjava/Makefile.am1
-rw-r--r--libjava/Makefile.in65
-rw-r--r--libjava/gcj/Makefile.in4
-rw-r--r--libjava/gnu/gcj/runtime/FirstThread.java10
-rw-r--r--libjava/gnu/gcj/runtime/VMClassLoader.java11
-rw-r--r--libjava/include/Makefile.in4
-rw-r--r--libjava/java/lang/natSystem.cc45
-rw-r--r--libjava/prims.cc11
-rw-r--r--libjava/testsuite/Makefile.in4
10 files changed, 98 insertions, 76 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 2a525d1..8356ea3 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,22 @@
+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.
+
2000-08-23 Mark Wielaard <mark@klomp.org>
* java/util/zip/InflaterInputStream.java (read(byte[],int,int)):
diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index ebf25e2..7413f26 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -225,6 +225,7 @@ $(nat_headers): libgcj.zip
java/lang/ClassLoader.h: java/lang/ClassLoader.class libgcj.zip
$(GCJH) -classpath $(top_builddir) \
-friend 'jclass _Jv_FindClass (_Jv_Utf8Const *name, java::lang::ClassLoader *loader);' \
+ -friend 'void _Jv_RunMain (const char *name, int argc, const char **argv, bool is_jar);' \
$(basename $<)
## Our internal main program needs to be able to create a FirstThread.
diff --git a/libjava/Makefile.in b/libjava/Makefile.in
index a470dc6..3ed381f 100644
--- a/libjava/Makefile.in
+++ b/libjava/Makefile.in
@@ -115,48 +115,31 @@ here = @here@
libgcj_basedir = @libgcj_basedir@
AUTOMAKE_OPTIONS = foreign no-installinfo
-@TESTSUBDIR_TRUE@SUBDIRS = \
-@TESTSUBDIR_TRUE@$(DIRLTDL) testsuite gcj include
-@TESTSUBDIR_FALSE@SUBDIRS = \
-@TESTSUBDIR_FALSE@$(DIRLTDL) gcj include
-@USE_LIBDIR_TRUE@toolexeclibdir = \
-@USE_LIBDIR_TRUE@$(libdir)$(MULTISUBDIR)
-@USE_LIBDIR_FALSE@toolexeclibdir = \
-@USE_LIBDIR_FALSE@$(toolexecdir)/lib$(MULTISUBDIR)
-@USE_LIBDIR_FALSE@toolexecdir = \
-@USE_LIBDIR_FALSE@$(exec_prefix)/$(target_alias)
+@TESTSUBDIR_TRUE@SUBDIRS = @TESTSUBDIR_TRUE@$(DIRLTDL) testsuite gcj include
+@TESTSUBDIR_FALSE@SUBDIRS = @TESTSUBDIR_FALSE@$(DIRLTDL) gcj include
+@USE_LIBDIR_TRUE@toolexeclibdir = @USE_LIBDIR_TRUE@$(libdir)$(MULTISUBDIR)
+@USE_LIBDIR_FALSE@toolexeclibdir = @USE_LIBDIR_FALSE@$(toolexecdir)/lib$(MULTISUBDIR)
+@USE_LIBDIR_FALSE@toolexecdir = @USE_LIBDIR_FALSE@$(exec_prefix)/$(target_alias)
toolexeclib_LTLIBRARIES = libgcj.la
toolexeclib_DATA = libgcj.spec
data_DATA = libgcj.zip
-@NEEDS_DATA_START_TRUE@toolexeclib_LIBRARIES = \
-@NEEDS_DATA_START_TRUE@libgcjdata.a
-@NEEDS_DATA_START_TRUE@libgcjdata_a_SOURCES = \
-@NEEDS_DATA_START_TRUE@libgcjdata.c
+@NEEDS_DATA_START_TRUE@toolexeclib_LIBRARIES = @NEEDS_DATA_START_TRUE@libgcjdata.a
+@NEEDS_DATA_START_TRUE@libgcjdata_a_SOURCES = @NEEDS_DATA_START_TRUE@libgcjdata.c
-@NATIVE_TRUE@bin_PROGRAMS = \
-@NATIVE_TRUE@jv-convert gij
+@NATIVE_TRUE@bin_PROGRAMS = @NATIVE_TRUE@jv-convert gij
bin_SCRIPTS = addr2name.awk
-@CANADIAN_TRUE@@NULL_TARGET_TRUE@GCJ = \
-@CANADIAN_TRUE@@NULL_TARGET_TRUE@gcj
-@CANADIAN_TRUE@@NULL_TARGET_FALSE@GCJ = \
-@CANADIAN_TRUE@@NULL_TARGET_FALSE@$(target_alias)-gcj
-@CANADIAN_FALSE@GCJ = \
-@CANADIAN_FALSE@$(expanded)/gcj$(EXEEXT) -B$(expanded)/
-@CANADIAN_TRUE@@NULL_TARGET_TRUE@ZIP = \
-@CANADIAN_TRUE@@NULL_TARGET_TRUE@$(MULTIBUILDTOP)../$(COMPPATH)/zip/zip$(EXEEXT)
-@CANADIAN_TRUE@@NULL_TARGET_FALSE@ZIP = \
-@CANADIAN_TRUE@@NULL_TARGET_FALSE@zip
-@CANADIAN_FALSE@ZIP = \
-@CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/zip/zip$(EXEEXT)
-@CANADIAN_TRUE@GCJH = \
-@CANADIAN_TRUE@gcjh
-@CANADIAN_FALSE@GCJH = \
-@CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/gcc/gcjh$(EXEEXT)
-@CANADIAN_FALSE@expanded = \
-@CANADIAN_FALSE@`cd $(MULTIBUILDTOP)../$(COMPPATH)/gcc && pwd`
+@CANADIAN_TRUE@@NULL_TARGET_TRUE@GCJ = @CANADIAN_TRUE@@NULL_TARGET_TRUE@gcj
+@CANADIAN_TRUE@@NULL_TARGET_FALSE@GCJ = @CANADIAN_TRUE@@NULL_TARGET_FALSE@$(target_alias)-gcj
+@CANADIAN_FALSE@GCJ = @CANADIAN_FALSE@$(expanded)/gcj$(EXEEXT) -B$(expanded)/
+@CANADIAN_TRUE@@NULL_TARGET_TRUE@ZIP = @CANADIAN_TRUE@@NULL_TARGET_TRUE@$(MULTIBUILDTOP)../$(COMPPATH)/zip/zip$(EXEEXT)
+@CANADIAN_TRUE@@NULL_TARGET_FALSE@ZIP = @CANADIAN_TRUE@@NULL_TARGET_FALSE@zip
+@CANADIAN_FALSE@ZIP = @CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/zip/zip$(EXEEXT)
+@CANADIAN_TRUE@GCJH = @CANADIAN_TRUE@gcjh
+@CANADIAN_FALSE@GCJH = @CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/gcc/gcjh$(EXEEXT)
+@CANADIAN_FALSE@expanded = @CANADIAN_FALSE@`cd $(MULTIBUILDTOP)../$(COMPPATH)/gcc && pwd`
GCJCOMPILE = CLASSPATH=$(here) $(LIBTOOL) --mode=compile $(GCJ) -fassume-compiled -L$(here) $(JC1FLAGS) -c
GCJLINK = $(LIBTOOL) --mode=link $(GCJ) -L$(here) $(JC1FLAGS) $(LDFLAGS) -o $@
@@ -170,10 +153,8 @@ WARNINGS = -W -Wall
AM_CXXFLAGS = -fno-rtti -fvtable-thunks -fasynchronous-exceptions \
@LIBGCJ_CXXFLAGS@ @EXCEPTIONSPEC@ $(WARNINGS) -D_GNU_SOURCE
-@USING_GCC_TRUE@AM_CFLAGS = \
-@USING_GCC_TRUE@@LIBGCJ_CFLAGS@ $(WARNINGS)
-@USING_GCC_FALSE@AM_CFLAGS = \
-@USING_GCC_FALSE@@LIBGCJ_CFLAGS@
+@USING_GCC_TRUE@AM_CFLAGS = @USING_GCC_TRUE@@LIBGCJ_CFLAGS@ $(WARNINGS)
+@USING_GCC_FALSE@AM_CFLAGS = @USING_GCC_FALSE@@LIBGCJ_CFLAGS@
JCFLAGS = -g
JC1FLAGS = -g @LIBGCJ_JAVAFLAGS@
@@ -225,8 +206,7 @@ extra_headers = java/lang/Object.h java/lang/Class.h
NM = nm
-@NATIVE_TRUE@@MAINTAINER_MODE_TRUE@noinst_PROGRAMS = \
-@NATIVE_TRUE@@MAINTAINER_MODE_TRUE@gen-from-JIS
+@NATIVE_TRUE@@MAINTAINER_MODE_TRUE@noinst_PROGRAMS = @NATIVE_TRUE@@MAINTAINER_MODE_TRUE@gen-from-JIS
CONVERT_DIR = gnu/gcj/convert
@@ -1045,7 +1025,7 @@ libgcj-test.spec.in libgcj.spec.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = tar
+TAR = gtar
GZIP_ENV = --best
DIST_SUBDIRS = @DIRLTDL@ testsuite gcj include @DIRLTDL@ gcj include
DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
@@ -1854,7 +1834,7 @@ distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
- cp -pr $$/$$file $(distdir)/$$file; \
+ cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
@@ -2088,6 +2068,7 @@ $(nat_headers): libgcj.zip
java/lang/ClassLoader.h: java/lang/ClassLoader.class libgcj.zip
$(GCJH) -classpath $(top_builddir) \
-friend 'jclass _Jv_FindClass (_Jv_Utf8Const *name, java::lang::ClassLoader *loader);' \
+ -friend 'void _Jv_RunMain (const char *name, int argc, const char **argv, bool is_jar);' \
$(basename $<)
gnu/gcj/runtime/FirstThread.h: gnu/gcj/runtime/FirstThread.class libgcj.zip
diff --git a/libjava/gcj/Makefile.in b/libjava/gcj/Makefile.in
index 26fec33..bd13f3d 100644
--- a/libjava/gcj/Makefile.in
+++ b/libjava/gcj/Makefile.in
@@ -129,7 +129,7 @@ DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = tar
+TAR = gtar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
@@ -198,7 +198,7 @@ distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
- cp -pr $$/$$file $(distdir)/$$file; \
+ cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
diff --git a/libjava/gnu/gcj/runtime/FirstThread.java b/libjava/gnu/gcj/runtime/FirstThread.java
index 2102225..8cf477f 100644
--- a/libjava/gnu/gcj/runtime/FirstThread.java
+++ b/libjava/gnu/gcj/runtime/FirstThread.java
@@ -55,11 +55,15 @@ final class FirstThread extends Thread
jarMainClassName = a.getValue(Attributes.Name.MAIN_CLASS);
- } catch (Exception e) {
-
- System.err.println ("Failed to load Main-Class manifest attribute from\n" + args[0]);
+ if (jarMainClassName != null)
+ return;
+ } catch (Exception e) {
+ // empty
}
+
+ System.err.println ("Failed to load Main-Class manifest attribute from\n"
+ + args[0]);
}
// If interpreter is invoked with -jar, the main class name is recorded
diff --git a/libjava/gnu/gcj/runtime/VMClassLoader.java b/libjava/gnu/gcj/runtime/VMClassLoader.java
index ae0a0eb..77051d2 100644
--- a/libjava/gnu/gcj/runtime/VMClassLoader.java
+++ b/libjava/gnu/gcj/runtime/VMClassLoader.java
@@ -34,7 +34,16 @@ final class VMClassLoader extends java.net.URLClassLoader
try
{
if (e.endsWith(".jar") || e.endsWith (".zip"))
- p.addElement(new URL("jar", "", -1, "file:///"+e+"!/"));
+ {
+ File archive = new File (e);
+ try {
+ p.addElement(new URL("jar", "", -1, "file://"
+ + archive.getCanonicalPath ()
+ + "!/"));
+ } catch (IOException ex) {
+ // empty
+ }
+ }
else if (e.endsWith ("/"))
p.addElement (new URL("file", "", -1, e));
else if (new File (e).isDirectory ())
diff --git a/libjava/include/Makefile.in b/libjava/include/Makefile.in
index 34d6c7b..dc184e5 100644
--- a/libjava/include/Makefile.in
+++ b/libjava/include/Makefile.in
@@ -128,7 +128,7 @@ DIST_COMMON = ./stamp-h.in Makefile.am Makefile.in config.h.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = tar
+TAR = gtar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
@@ -225,7 +225,7 @@ distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
- cp -pr $$/$$file $(distdir)/$$file; \
+ cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
diff --git a/libjava/java/lang/natSystem.cc b/libjava/java/lang/natSystem.cc
index 81f7860..2672895 100644
--- a/libjava/java/lang/natSystem.cc
+++ b/libjava/java/lang/natSystem.cc
@@ -348,34 +348,31 @@ java::lang::System::init_properties (void)
}
}
- // FIXME: find libgcj.zip and append its path?
- char *classpath = ::getenv("CLASSPATH");
- jstring cp = properties->getProperty (JvNewStringLatin1("java.class.path"));
- java::lang::StringBuffer *sb = new java::lang::StringBuffer ();
-
if (_Jv_Jar_Class_Path)
+ properties->put(JvNewStringLatin1 ("java.class.path"),
+ JvNewStringLatin1 (_Jv_Jar_Class_Path));
+ else
{
- sb->append (JvNewStringLatin1 (_Jv_Jar_Class_Path));
-#ifdef WIN32
- sb->append ((jchar) ';');
-#else
- sb->append ((jchar) ':');
-#endif;
- }
- if (classpath)
- {
- sb->append (JvNewStringLatin1 (classpath));
+ // FIXME: find libgcj.zip and append its path?
+ char *classpath = ::getenv("CLASSPATH");
+ jstring cp = properties->getProperty (JvNewStringLatin1("java.class.path"));
+ java::lang::StringBuffer *sb = new java::lang::StringBuffer ();
+
+ if (classpath)
+ {
+ sb->append (JvNewStringLatin1 (classpath));
#ifdef WIN32
- sb->append ((jchar) ';');
+ sb->append ((jchar) ';');
#else
- sb->append ((jchar) ':');
+ sb->append ((jchar) ':');
#endif;
+ }
+ if (cp != NULL)
+ sb->append (cp);
+ else
+ sb->append ((jchar) '.');
+
+ properties->put(JvNewStringLatin1 ("java.class.path"),
+ sb->toString ());
}
- if (cp != NULL)
- sb->append (cp);
- else
- sb->append ((jchar) '.');
-
- properties->put(JvNewStringLatin1 ("java.class.path"),
- sb->toString ());
}
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);
diff --git a/libjava/testsuite/Makefile.in b/libjava/testsuite/Makefile.in
index 180ce65..da2b002 100644
--- a/libjava/testsuite/Makefile.in
+++ b/libjava/testsuite/Makefile.in
@@ -137,7 +137,7 @@ DIST_COMMON = ChangeLog Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = tar
+TAR = gtar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
@@ -165,7 +165,7 @@ distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
- cp -pr $$/$$file $(distdir)/$$file; \
+ cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \