Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

How do I run my SWT app outside Eclipse?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Eric. BTW, your SWT Designer looks really nice. I'm going to check out the trial.

-Nigel
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic