/******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.swt.snippets; /* * example snippet: Hello World * * For a list of all SWT example snippets see * http://www.eclipse.org/swt/snippets/ */ import org.eclipse.swt.widgets.*; public class Snippet1 { public static void main (String [] args) { Display display = new Display (); Shell shell = new Shell(display); shell.open (); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } } And then: tudor@epsilon:~/development/swttest$ gcj -c --CLASSPATH=/usr/lib/java/swt.jar Snippet1.java tudor@epsilon:~/development/swttest$ gcj -o Snippet1 --main=Snippet1 Snippet1.o /usr/lib/gcj-4.1/org.eclipse.swt.gtk.linux.x86_3.1.1.jar.so /tmp/ccxSnQXH.o: In function `main': ccPE7ruz.i:(.text+0x1d): undefined reference to `Snippet1::class$$' Snippet1.o: In function `void org::eclipse::swt::snippets::Snippet1::main(JArray*)': Snippet1.java:(.text+0x16): undefined reference to `org::eclipse::swt::widgets::Display::class$' Snippet1.java:(.text+0x31): undefined reference to `org::eclipse::swt::widgets::Shell::class$' collect2: ld returned 1 exit status tudor@epsilon:~/development/swttest$ gcj --version gcj (GCC) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-14ubuntu7) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.