Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Make SWT/Jface application outside of Eclipse
Make SWT/Jface application outside of Eclipse [message #212004] Thu, 24 May 2007 21:18 Go to next message
Eclipse UserFriend
Originally posted by: agent_tony_smith.hotmail.com

Hi,
Sorry I'm a beginner with both Eclipse and Java (especially when it comes
to compiling and running programs, not so much the programing itself).
I designed a dummy SWT application (see code at the end). I can run it
just fine in Eclipse. What I'd like to be able to do now is run it outside
of the context of Eclipse, like just clicking on an icon and see my
program pop up and disappear when I want it to close.
I tried to write a little script that does this:
java -cp " /home/tomcat/Desktop/swt-M20070212-1330-gtk-linux-x86/swt.ja r;. "
Hello2

I get:
Exception in thread "main" java.lang.NoClassDefFoundError: Hello2

though:
[tomcat@m8 bin]$ ls -l
total 36
-rw-rw-r-- 1 tomcat tomcat 934 May 24 17:09 Hello2$1.class
-rw-rw-r-- 1 tomcat tomcat 1660 May 24 17:09 Hello2.class
...

Does anybody know what I should do? I guess I should create a jar or
something but again, not very familiar with all this ^_^
Thanks!

-------------------------------------------
Dummy application:

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

public class Hello2 {

public static Display display ;
public static Shell shell;
public static Label label;
public static Button submit;
public static int i=0;

/**
* @param args
*/
public static void main(String[] args) {
display = new Display();
shell = new Shell (display);
shell.setLayout(new RowLayout());
label = new Label (shell, 0);
label.setText("nothing");
submit = new Button (shell, 1 << 3);
submit.setText("Submit");
i=0;

submit.addSelectionListener ( new SelectionAdapter() {
public void widgetSelected (SelectionEvent e) {
String s = i + "";
label.setText( s );
i++;
}
});

shell.setSize(500, 500);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
label.dispose();
shell.dispose();
submit.dispose();
}
}
Re: Make SWT/Jface application outside of Eclipse [message #212011 is a reply to message #212004] Thu, 24 May 2007 22:14 Go to previous messageGo to next message
Matt McCutchen is currently offline Matt McCutchenFriend
Messages: 32
Registered: July 2009
Member
On Thu, 2007-05-24 at 21:18 +0000, Anthony wrote:
> I tried to write a little script that does this:
> java -cp " /home/tomcat/Desktop/swt-M20070212-1330-gtk-linux-x86/swt.ja r;. "
> Hello2
>
> I get:
> Exception in thread "main" java.lang.NoClassDefFoundError: Hello2

Use a colon, not a semicolon, to separate classpath entries on Linux.

Matt
Re: Make SWT/Jface application outside of Eclipse [message #212191 is a reply to message #212011] Sat, 26 May 2007 15:32 Go to previous message
Eclipse UserFriend
Originally posted by: agent_tony_smith.hotmail.com

Thanks, I'll try that ;)
Previous Topic:How to get the Caret point in an editor
Next Topic:Plug-in tutorial
Goto Forum:
  


Current Time: Thu Mar 28 18:18:42 GMT 2024

Powered by FUDForum. Page generated in 0.03746 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top