I made the following small file with Eclipse, using the SWT Library:
//all the imports
public class classtest {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setSize(300, 200);
shell.setText("Button Example");
//shell.setLayout(new RowLayout());
Button button = new Button(shell, SWT.PUSH);
button.setLocation(20,20);
button.setSize(new Point(70,30)); //new point seems to be optional?
button.setText("Buttontje ");
shell.open ();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
The .jar I made out of it runs totally fine on windows.
Now I installed Java on Ubuntu using the following commands (from http://www.ubuntugeek.com/how-to-install-oracle-java-7-in-ubuntu-12-04.html ):
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
Java seemed to be installed fine. I run the file, but nothing happens. An other program of me, though, using only JButtons and no SWT Library, DOES run.
Do I need to install the SWT library on the target platform to make it work? But how would I install it? I thought the SWT Library would be included in the .jar so that it would run the SWT layout on every platform, as long as java is installed.