Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I run my SWT app outside Eclipse?

 
Nigel Skeffington
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings!

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.

Regards,
Nigel
 
Eric Clayberg
author
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Nigel Skeffington
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Eric. BTW, your SWT Designer looks really nice. I'm going to check out the trial.

-Nigel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic