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



Thomas A. Russ wrote:
Knute Johnson <nospam@xxxxxxxxxxxxxxxxxxxxxxx> writes:

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:
...
class swing_app {

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

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.

I think this is only true for public classes. Non public classes can be
included in files with any name. (Not that it's a good idea....)



You're right, if the class is declared public it must match the name of the file. If not public it will compile and it will produce class files for every class. You can even put main() methods in each of the classes and run them. I don't know what that does to package visibility.

--

Knute Johnson
email s/nospam/knute/
.



Relevant Pages

  • Re: "The page cannot be displayed"
    ... > the problem to SP2. ... > Sun Java may solve the problem as corruption with MS Java may give ... Go to the Windows Update Site (Start/All Programs/Windows Update/Personalize ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: SP2 and Javascript problem
    ... > This is a well known problem that happens with the installation of SP2. ... > You can test whether Java is working on your machine at the following ... > Sun also offers an automatic download and install of the 1.4 Java plug-in ... > Allow active content to run in files on My Computer - Windows XP Service ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Links wont open in IE
    ... > One of the links I tried is the play online button at ... > Windows Update history it said that the Windows Service Pack 2 ... The Popcap games like Bejeweled require Java. ... For the SP2 issue, look at the System applet in Control Panel. ...
    (microsoft.public.windowsxp.general)
  • Re: XP SP2 and Java
    ... Microsoft is not required to ship Sun's Java Virtual Machine with Windows. ... Will the XP SP2 come with Sun's Java? ...
    (microsoft.public.windowsxp.general)
  • 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)