Re: Exception in thread "main" java.lang.NoClassDefFoundError: sampl
- From: Knute Johnson <nospam@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 20 Apr 2007 14:22:50 -0700
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/
.
- References:
- Exception in thread "main" java.lang.NoClassDefFoundError: sampl
- From: xcrazy
- Re: Exception in thread "main" java.lang.NoClassDefFoundError: sampl
- From: Knute Johnson
- Re: Exception in thread "main" java.lang.NoClassDefFoundError: sampl
- From: Thomas A. Russ
- Exception in thread "main" java.lang.NoClassDefFoundError: sampl
- Prev by Date: Weird Java 6 Double-buffering Problem
- Next by Date: South Florida Software Symposium - May 18 - 20, 2007
- Previous by thread: Re: Exception in thread "main" java.lang.NoClassDefFoundError: sampl
- Next by thread: Post and View IT Jobs & Resumes - FREE
- Index(es):
Relevant Pages
|