Re: Exception in thread "main" java.lang.NoClassDefFoundError: sampl



xcrazy wrote:
Hi, I know this is a common error, but this occurs only in some of my
programs.
I run java on windows XP SP2, jdk1.5
My sampl.java file is like this:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

class swing_app {
public static void main(String[] args) {
JDesktopPane desktop = new JDesktopPane();
desktop.add(desktop,BorderLayout.CENTER);
JInternalFrame internalFrame = new
JInternalFrame("Internal
Frame",true,true,true,true);
internalFrame.setBounds(50,50,200,100);
desktop.add(internalFrame,new Integer(1));
}

}

It compiles giving me a "sampl.class" file but when i type this
java sampl

I get this error: - Exception in thread "main"
java.lang.NoClassDefFoundError: sampl

I don't get this error in a simple "Hello world" program.....
This is how i've set my paths:

Path=c:\j2sdkee1.3.1\bin;%SystemRoot%\system32;%SystemRoot%;
%SystemRoot
%\system32\WBEM;%SYSTEMROOT%\system32\WBEMC:
\PROGRA~1\COMMON~1\AUTODE~1;.;C:\Java\jdk1.5.0_09\bin;c:\Java
\jdk1.5.0_09\lib;

CLASSPATH= .;C:\Java\jdk1.5.0_09\lib;C:\Java\jdk1.5.0_09\bin;C:
\j2sdkee1.3.1\bin;

Please help!!


I don't know how you get it to compile if it is in a file named sampl.java? The file name and the class name must match. Anyway your program isn't going to do anything without a window or frame to hold your components. You should probably get rid of the CLASSPATH environment variable too, it is almost never needed.

--

Knute Johnson
email s/nospam/knute/
.



Relevant Pages

  • Re: Windows Startup Taking a Long Time
    ... It may help speed up your system, but it should be clean ... using Windows XP "prettifications". ... As for Service Pack 2 (SP2) for Windows XP, ... You should at least turn on the built in firewall. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Slow startup and shutdown
    ... > applications that have always been present, ... The problem began before loading SP2 and hasn't changed. ... using Windows XP "prettifications". ... You should at least turn on the built in firewall. ...
    (microsoft.public.windowsxp.perform_maintain)
  • Re: question about clean install after SP2
    ... > After SP2 install my IE was seriously defective. ... You should periodically defragment your hard drives as well as check them ... using Windows XP "prettifications". ... You should at least turn on the built in firewall. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Browser Adverts????????
    ... With everything in this list and SP2.. ... It contains advice ... using Windows XP "prettifications". ... You should at least turn on the built in firewall. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Frequent Hourglass in Explorer
    ... I think this did start happening when I upgraded to SP2. ... frequently check Windows Update, etc., but haven't upgraded back to SP2 yet, ... >>Many times lately, when I try to do some function in Windows Explorer, ... > to what you are reporting. ...
    (microsoft.public.windowsxp.general)