Re: -Djava.awt.headless=true and Gtk...
Stephen Compall <[email protected]> Wed, 03 Aug 2005 20:09:19 -0500
| Newsgroups | gmane.comp.java.vm.sablevm.general |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 2005-08-03 at 18:44 -0400, Martin Cordova wrote: > "GDK is basically a wrapper around the standard Xlib function calls. > If you are at all familiar with Xlib, a lot of the functions in GDK > will require little or no getting used to. All functions are written > to provide an way to access Xlib functions in an easier and slightly > more intuitive manner. In addition, since GDK uses GLib (see below), > it will be more portable and safer to use on multiple platforms." > > >From its description, GDK on Linux relies on XLib. On GNU, perhaps. But GDK is drawing primitives ported to non-X GUIs as well, and there's no point to duplicating that work. Blame eager static initializers. As stated by native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c:155, gtk_init must be called before any other GTK calls; the easiest way to ensure this is with a static initializer. Then, note the static initializer at gnu/java/awt/peer/gtk/GtkToolkit.java:109, which calls the Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkInit function very near the aforementioned C file position, which in turn calls gtk_init, which itself tries to connect to the X server and exits the process if it fails. This is triggered simply by loading the class. > Does this means that there is no way to use a headless environment > w/Classpath (without graphics desktop running on server)?? Many applications don't load any classes that load GtkToolkit, and these can be run on Classpath-using JVMs as-is. Apps that refer to, or especially initialize instances of, AWT/Swing classes force a call to gtk_init. Hacking eager initializers to be lazy is hard work. The easiest fix I can think of with my limited knowledge of GUI drawing is a Java-based solution: make a "dummy" AWT peer that only pretends. This would still be some effort, so Etienne Gagnon's earlier suggestion of asking the GNU Classpath folks is probably best; they may know something we don't. In the meantime, the best hack I can think of is to fake out libgtkpeer by starting a VNC server running twm (or nothing if you can get that to work), and telling sablevm to use its display. Your system constraints may prevent this, however. -- Stephen Compall _______________________________________________ SableVM-user mailing list [email protected] http://sablevm.org/lists/control/listinfo/sablevm-user
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQBC8Wq+YWjD35Pp0wIRAgxKAKCNU4RDsaeiTUbPmceR/IRnnV5rwACffqeW p9ZGhACB2vwasgPSUdnUxFo= =c7T9 -----END PGP SIGNATURE-----