I've developed an application in Eclipse using SWT. It runs fine in Eclipse by using Run->Run as->Java Application.
When I try to run the application outside of Eclipse, I use the -Djava_library_path to point to the SWT libs, but I always receive this error: Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/swt/widgets/Composite
I get the same when I try to package it in a jar; I'm not even sure how to package up an SWT app in a jar. I fairly new to Eclipse and SWT so any suggestions are welcome.
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/swt/widgets/Composite
You need to make sure that the swt.jar file is included on your classpath. The swt.jar is in the <eclipse>\plugins\org.eclipse.swt.win32_3.0.0\ws\win32 directory. You also need to make sure that the SWT DLL (e.g., swt-win32-3062.dll) is on your path. The SWT DLL is in the <eclipse>\plugins\org.eclipse.swt.win32_3.0.0\os\win32\x86 directory.
Software Engineering Manager
Joined: Mar 20, 2004
Thanks Eric. BTW, your SWT Designer looks really nice. I'm going to check out the trial.