Re: Mounting filesystems and such
Tim Boudreau <[email protected]> Mon, 15 Jul 2002 12:28:53 +0200
| Newsgroups | gmane.comp.java.netbeans.education |
|---|---|
| Organization | Sun Microsystems |
| Message-ID | <[email protected]> |
Sean Kirkpatrick wrote:
> Hi all.
>
> I'm new to Java, new to NetBeans, and have been assigned the Java
> Programming course at my JC this semester. I'm excited about teaching
> Java - have been looking for an excuse to learn it for a while (in my
> real life, we don't use java at all for performance reasons - I'm a
> programmer for Agilent Technologies).
>
> I'm working my way through Thinking in Java, and have loaded Eckel's
> code onto my machine for experimentation. I've mounted a subdir called
> "code" as a filesystem, and want to be able to open each chapter subdir
> and compile/run the code from there. However, I think I have a path
> problem that is causing the following error.
>
> I'm trying to run some code ~/code/c03/VowelsAndConsonants.java, but
> when I compile, it gives me the error
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> c03/VowelsAndConsonants (wrong name: VowelsAndConsonants)
Hi, Sean,
Since this list is geared toward teaching Java, you will probably reach
a wider audience for general java questions on one of the forums at
http://java.sun.com/ or newsgroups like comp.lang.java.* - but thanks
for posting nonetheless!
As for your current problem, probably your class and file names don't
match (look for typos) - for example, if you create an unpackaged java
source Foo.java with a main method, and then inside you have
public class Goo extends Object {
public static void main (String args[]) {
System.out.println ("Hello world");
}
}
it will compile fine, but it will produce a runtime error. Note that
if it is in a package, it will work.
It is also possible to mispackage something (e.g. have a package
statement in source that doesn't match your actual package structure)
and have it compile but not be runnable.
So are you going to be using NetBeans in the classroom, or recommending
it? One of the purposes of this list is to create a forum for people
teaching Java to congregate. So far, it's been less than a wild
success, but we also haven't had a lot of resources to through at
making it successful, which is the primary reason.
Best regards,
-Tim