diff options
| author | Per Bothner <per@bothner.com> | 2001-05-21 23:47:48 -0700 |
|---|---|---|
| committer | Per Bothner <bothner@gcc.gnu.org> | 2001-05-21 23:47:48 -0700 |
| commit | c93d7fae7b9825449c023d42eb40641c0ad80be2 (patch) | |
| tree | ecfc0fb5d915f5f6596ef061114d1b6b7ec5270a /libjava/gnu/gcj/runtime/FirstThread.java | |
| parent | b4fbaca7cb5c6ff5fb5e24e554d510257cb488eb (diff) | |
Implement invocation interface; don't create new thread for main.
From-SVN: r42428
Diffstat (limited to 'libjava/gnu/gcj/runtime/FirstThread.java')
| -rw-r--r-- | libjava/gnu/gcj/runtime/FirstThread.java | 48 |
1 files changed, 9 insertions, 39 deletions
diff --git a/libjava/gnu/gcj/runtime/FirstThread.java b/libjava/gnu/gcj/runtime/FirstThread.java index 469d5dde588..fd59261c8c8 100644 --- a/libjava/gnu/gcj/runtime/FirstThread.java +++ b/libjava/gnu/gcj/runtime/FirstThread.java @@ -19,59 +19,29 @@ import java.util.jar.*; // This is entirely internal to our implementation. -final class FirstThread extends Thread +final class FirstThread { - 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) + public static String getMain (String name) { + String mainName = null; try { - JarFile j = new JarFile (args[0]); + JarFile j = new JarFile (name); Attributes a = j.getManifest().getMainAttributes(); - jarMainClassName = a.getValue(Attributes.Name.MAIN_CLASS); + mainName = a.getValue(Attributes.Name.MAIN_CLASS); - if (jarMainClassName != null) - { - jarMainClassName = jarMainClassName.replace('/','.'); - return; - } } catch (Exception e) { // empty } - System.err.println ("Failed to load Main-Class manifest attribute from\n" - + args[0]); + if (mainName == null) + System.err.println ("Failed to load Main-Class manifest attribute from\n" + + name); + return mainName; } - // 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; |
