Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » New to eclipse and SWT(Cant get it to run outside of eclipse)
New to eclipse and SWT [message #524199] Wed, 31 March 2010 07:06 Go to next message
David is currently offline DavidFriend
Messages: 1
Registered: March 2010
Junior Member
I recently downloaded SWT and a Gui builder that uses it in eclipse. I created my program and Gui, tested and everything works fine while i am in eclipse.

Unfortunately i need to turn a working copy into my professor, and the source code will not compile properly. It looks like the java compiler does not find the SWT package that i downloaded.

I have tried using -cp and pointing it to the SWT.jar in the org.eclipse.SWT project folder in my eclipse workspace. i also have to tell the compiler where the source files are. after doing this it compiles without any errors. but when you go to run the class file it crashes saying:

Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/swt/widgets/Composite
Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.widgets.Composite
at$ Source)
at Method)
at Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: LinkList. Program will exit.

Is there something i am missing on the install part of SWT in eclipse? or is there something special you have to do to get the program to run outside of eclipse?

any help is appreciated. Embarrassed

EDIT: after messing around in eclipse i exported my project to an executable .jar file and it ran. I am still not sure why the java compiler outside of eclipse wont work...

[Updated on: Wed, 31 March 2010 17:04]

Report message to a moderator

Re: New to eclipse and SWT [message #524666 is a reply to message #524199] Thu, 01 April 2010 18:14 Go to previous message
Roger Shimada is currently offline Roger ShimadaFriend
Messages: 4
Registered: January 2010
Junior Member
To allow anyone to compile your source the least painful way would be to give them the executable jar you created in Eclipse and use that as the classpath.

Running the code may be complicated because SWT needs native code. If you downloaded SWT for Windows 32-bit, this is probably included in your jar. If a user is running 32-bit or 64-bit Windows they can use your jar for the classpath to run. If not, the user would need to download SWT for their operating system.
Previous Topic:Lockable Composite
Next Topic:embedded debugger in SWT browser
Goto Forum:

Current Time: Thu Dec 05 14:25:40 GMT 2019

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

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

Back to the top