1 // FirstThread.java - Implementation of very first thread.
3 /* Copyright (C) 1998, 1999, 2000 Free Software Foundation
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
11 package gnu.gcj.runtime;
13 import java.util.jar.*;
16 * @author Tom Tromey <tromey@cygnus.com>
17 * @date August 24, 1998
20 // This is entirely internal to our implementation.
22 final class FirstThread extends Thread
24 public native void run ();
26 public FirstThread (Class k, Object o)
28 super (null, null, "main");
34 public FirstThread (String class_name, Object o)
36 super (null, null, "main");
38 klass_name = class_name;
42 private static void die (String s)
44 System.err.println(s);
48 public static void main (String[] args)
52 JarFile j = new JarFile (args[0]);
54 Attributes a = j.getManifest().getMainAttributes();
56 jarMainClassName = a.getValue(Attributes.Name.MAIN_CLASS);
58 if (jarMainClassName != null)
60 jarMainClassName = jarMainClassName.replace('/','.');
63 } catch (Exception e) {
67 System.err.println ("Failed to load Main-Class manifest attribute from\n"
71 // If interpreter is invoked with -jar, the main class name is recorded
73 public static String jarMainClassName;
77 private String klass_name;
80 // If the user links statically then we need to ensure that these
81 // classes are linked in. Otherwise bootstrapping fails. These
82 // classes are only referred to via Class.forName(), so we add an
83 // explicit mention of them here.
84 static final Class Kcert = java.security.cert.Certificate.class;
85 static final Class Kfile = gnu.gcj.protocol.file.Handler.class;
86 static final Class Khttp = gnu.gcj.protocol.http.Handler.class;
87 static final Class Kjar = gnu.gcj.protocol.jar.Handler.class;