mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-11 03:44:38 +08:00
6aaeb97551
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
78 lines
1.5 KiB
Java
78 lines
1.5 KiB
Java
// FirstThread.java - Implementation of very first thread.
|
|
|
|
/* Copyright (C) 1998, 1999 Free Software Foundation
|
|
|
|
This file is part of libgcj.
|
|
|
|
This software is copyrighted work licensed under the terms of the
|
|
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
|
details. */
|
|
|
|
package gnu.gcj.runtime;
|
|
|
|
import java.util.jar.*;
|
|
|
|
/**
|
|
* @author Tom Tromey <tromey@cygnus.com>
|
|
* @date August 24, 1998
|
|
*/
|
|
|
|
// This is entirely internal to our implementation.
|
|
|
|
final class FirstThread extends Thread
|
|
{
|
|
public native void run ();
|
|
|
|
public FirstThread (Class k, Object o)
|
|
{
|
|
super (null, null, "main");
|
|
klass = k;
|
|
klass_name = null;
|
|
args = o;
|
|
}
|
|
|
|
public FirstThread (String class_name, Object o)
|
|
{
|
|
super (null, null, "main");
|
|
klass = null;
|
|
klass_name = class_name;
|
|
args = o;
|
|
}
|
|
|
|
private static void die (String s)
|
|
{
|
|
System.err.println(s);
|
|
System.exit(1);
|
|
}
|
|
|
|
public static void main (String[] args)
|
|
{
|
|
try {
|
|
|
|
JarFile j = new JarFile (args[0]);
|
|
|
|
Attributes a = j.getManifest().getMainAttributes();
|
|
|
|
jarMainClassName = a.getValue(Attributes.Name.MAIN_CLASS);
|
|
|
|
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
|
|
// here.
|
|
public static String jarMainClassName;
|
|
|
|
// Private data.
|
|
private Class klass;
|
|
private String klass_name;
|
|
private Object args;
|
|
}
|