Ryan McDougall writes: > I apologize if this question is too low level for this list, but I've > spend the entire afternoon googling to no avail. This is very much on-topic. > I am trying to compile a simple SWT app using either Sun's Java or GCJ > (preferably both) on my FC4 system. If I am successful at this (and the > process is indeed complex), I don't mind writing up a tutorial for the > Wiki or some such, in return. > > I have gcj and eclipse installed, as well as Sun's 1.5 JDK (java and > javac are currently linked to Suns JVM, but I can change that back). > short. > > Here are the current rpms that are relevant: > libswt3-gtk2-3.1.0_fc-0.M6.22 > libgcj-4.0.0-8 > gcc-java-4.0.0-8 > java-1.4.2-gcj-compat-devel-1.4.2.0-40jpp_31rh > java-1.4.2-gcj-compat-1.4.2.0-40jpp_31rh > > Here is the simple app source in a file called TestGui.java: > > import org.eclipse.swt.*; > > public class TestGui > { > public static void main (String [] args) { > Display display = new Display (); > Shell shell = new Shell (display); > Label label = new Label (shell, SWT.CENTER); > label.setText ("Hello_world"); > label.setBounds (shell.getClientArea ()); > shell.open (); > while (!shell.isDisposed ()) { > if (!display.readAndDispatch ()) display.sleep (); > } > display.dispose (); > } > } > > I have tried the following commands based on guesses based on online > tutorials: > > $ gcj > --classpath=/usr/share/eclipse/plugins/org.eclipse.swt.gtk_3.1.0.jar /usr/lib/eclipse/plugins/org.eclipse.swt.gtk_3.1.0.jar.so --main=TestGui TestGui.java -o Test > > Running Test gives me the following error: > > Exception in thread "main" java.lang.LinkageError: unexpected exception > during linking: org.eclipse.swt.widgets.Display > at java.lang.VMClassLoader.transformException(java.lang.Class, > java.lang.Throwable) (/usr/lib/libgcj.so.6.0.0) > at java.lang.VMClassLoader.resolveClass(java.lang.Class) > (/usr/lib/libgcj.so.6.0.0) > at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.6.0.0) > at TestGui.main(java.lang.String[]) (Unknown Source) > at gnu.java.lang.MainThread.call_main() (/usr/lib/libgcj.so.6.0.0) > at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0) > Caused by: java.lang.NullPointerException > at java.lang.VMClassLoader.resolveClass(java.lang.Class) > (/usr/lib/libgcj.so.6.0.0) > ...4 more OK, I had to add one line at the start of your demo: import org.eclipse.swt.widgets.*; And I tried to run it: $ gij -classpath /usr/share/eclipse/plugins/org.eclipse.swt.gtk_3.1.0.jar TestGui Exception in thread "main" java.lang.UnsatisfiedLinkError: libswt-pi-gtk-3128: file not found at java.lang.Runtime._load(java.lang.String, boolean) (/usr/lib/libgcj.so.6.0.0) So, where is libswt-pi-gtk-3128 ? Bizzarrely, I found it in $HOME/.eclipse/org.eclipse.platform_3.1.0/configuration/org.eclipse.osgi/bundles/59/1/.cp/os/linux/x86/libswt-pi-gtk-3128.so (sorry, no, I have *no idea* why it's there) And then I ran the test like this: LD_LIBRARY_PATH=$HOME/.eclipse/org.eclipse.platform_3.1.0/configuration/org.eclipse.osgi/bundles/59/1/.cp/os/linux/x86 java -classpath /usr/share/eclipse/plugins/org.eclipse.swt.gtk_3.1.0.jar TestGui which ran fine. There is probably some more official way of getting the path to libswt-pi-gtk-3128.so. Andrew.