Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] java.lang.NoClassDefFoundError when running a standalone SWT application

David,

Thank you for letting me know two kinds of advices.

As I have just started with learning eclipse project, I could not get
well-understanding of how to use.
In future, I will use  the newsgroups for such as basic questions and got to
run my sample when putting ".;" in classpath.
Thank you for your cooperation.


----- Original Message ----- 
From: "David Whiteman" <dlwhiteman@xxxxxxxxxxxxxxx>
To: <platform-swt-dev@xxxxxxxxxxx>
Sent: Saturday, July 03, 2004 11:27 AM
Subject: Re: [platform-swt-dev] java.lang.NoClassDefFoundError when running
a standalone SWT application


> Ryoji Kawaguchi wrote:
>
> >Hi all,
> >
> >Anyone can help me in trouble of facing "java.lang.NoClassDefFoundError"
> >when trying to excuse a standalone SWT application complied on the
> >environment of SWT ver 2.13 and j2sdk1.4.2_04, taking following steps,
> >
> >1) dir
> >
> > C:\j2sdk1.4.2_04\work
> >2004/07/03  09:52       <DIR>          .
> >2004/07/03  09:52       <DIR>          ..
> >2004/03/11  04:17              278,528 swt-win32-2136.dll
> >2004/03/11  04:17            1,019,114 swt.jar
> >2004/06/29  21:52                  455 WindowSample1.BAK
> >2004/07/03  09:52                  699 WindowSample1.class
> >2004/07/03  09:50                  431 WindowSample1.java
> >
> >
> >
> >2) Compiling from DOS command prompt of Windows 2000
> >
> >C:\j2sdk1.4.2_04\work>javac -classpath swt.jar WindowSample1.java
> >
> >
> >
> >3) Executing from DOS command
> >
> >C:\j2sdk1.4.2_04\work>java -classpath swt.jar WindowSample1
> >Exception in thread "main" java.lang.NoClassDefFoundError: WindowSample1
> >
> >C:\j2sdk1.4.2_04\work>java WindowSample1
> >Exception in thread "main" java.lang.NoClassDefFoundError:
> >org/eclipse/swt/widge
> >ts/Display
> >        at WindowSample1.main(WindowSample1.java:6)
> >
> >
> >4) Source code of a sample program using swt
> >
> >---------------------------------------------------------
> >import org.eclipse.swt.widgets.*;
> >
> >public class WindowSample1 {
> >  public static void main (String [] args) {
> >    Display display = new Display ();
> >    Shell shell = new Shell(display);
> >    shell.setText("Window Sample1");
> >    shell.setSize(200,100);
> >    shell.open();
> >    while (!shell.isDisposed ()){
> >      if (!display.readAndDispatch ()){
> >        display.sleep ();
> >      }
> >    }
> >    display.dispose ();
> >  }
> >}
> >
> >
>
> Ryoji,
>
> In the future, please use the newsgroups for these kinds of questions.
> That said, it appears you just need to put the current directory on your
> classpath as well, such as:
>
> -classpath .;swt.jar
>
> You will also need to specify the current directory for the
> java.library.path so the SWT dll will be located.
>
> Hope this helps,
> David
> _______________________________________________
> platform-swt-dev mailing list
> platform-swt-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/platform-swt-dev



Back to the top