Executing Gcj-SWT native code fails
krimo
aait@free.fr
Mon Jan 17 12:08:00 GMT 2005
Hi guys,
I actually work on a SWT GUI I want to be compiled natively with gcj.
My concern is that when I launch the binary generated by gcj, no window
is visible,
however my program still run and give me the basic debug message like
("Hello").
If somebody already encountred this problem... some help will be very
appreciate:
Here is my sample code:
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
public class Test {
public static void main(String[] args){
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Hello World");
shell.setSize(200,100);
shell.open ();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep ();
}
display.dispose ();
}
}
And my Makefile:
gcj -c -Wall -I./lib/swt.jar --classpath=src/ src/Test.java
#Linking all
gcj --main=Test Test.o -lswt -lswt-pi -o Test
I've tested gcj-3.3 and gcj-3.4 on a debian sid. As my GUI source code,
this small example doesn't work!
Regards.
More information about the Java
mailing list