Exception in thread "main" java.lang.NoClassDefFoundError: label (wrong
name: Label)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
I have absolutely no idea what it means or why I can't run the program - can
anyone offer a solution? I've looked on the SUN site and can find no
reference to the problem
Thanks
> Hi, as a newbie to java I downloaded the J2SDK1.4.1 from the Sun site and
> installed it as normal. Now I have a java prog I want to compile and using
> the javac command everything compiles fine. Then, when I try to execute
the
> program (even the "hello world" example) I get the following error:
Can you show us the exact (cut and pasted, no mods) Hello World code you're
compiling, and the command line you use to run the code (not compile, note,
since you say that goes fine), and then the full stack trace if that you
already give is not complete? If even Hello World goes wrong, it seems your
setup is incorrect...
--
--
Jason Teagle
ja...@teagster.co.uk
-----------------------------------------------------------
A list of programming resources I use:
ML: www.windev.org, www.codecipher.com, www.beginthread.com
MB: www.codeguru.com, www.codeproject.com
NG: comp.lang.java.*
OI: www.php.net
-----------------------------------------------------------
public class Hello {
public static void main(String[] args)
{
System.out.println("Hello world");
}
}
Below is the DOS window output from this file:
C:\Java>javac Hello.java
C:\Java>java hello
Exception in thread "main" java.lang.NoClassDefFoundError: hello (wrong
name: Hello)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
C:\Java>
Any ideas?
Thanks
"Jason Teagle" <ja...@teagster.co.uk> wrote in message
news:Tkxq9.900$R07....@newsfep1-win.server.ntli.net...
> C:\Java>javac Hello.java
>
> C:\Java>java hello
There's your problem, I believe: Java is case-sensitive in its filenames, so
if you compile a file called Hello.java it should be output as Hello.class -
and thus must be run as Hello, not hello.
C:\Java>java Hello
and not
C:\Java>java hello
MoshiX
Welshlad wrote:
> Hi. For example, in a file called "Hello. java" I have a simple Hello
> world
> demo as follows:
>
> public class Hello {
> public static void main(String[] args)
> {
> System.out.println("Hello world");
> }
> }
>
> Below is the DOS window output from this file:
>
> C:\Java>javac Hello.java
>
> C:\Java>java hello
> Exception in thread "main" java.lang.NoClassDefFoundError: hello (wrong
> name: Hello)
> at java.lang.ClassLoader.defineClass0(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
> at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
> at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
>
> C:\Java>
>
>
> Any ideas?
>
> Thanks
>
>
>
> "Jason Teagle" wrote in message
> news:Tkxq9.900$R07....@newsfep1-win.server.ntli.net...
>
> >"Welshlad" wrote in message
> >news:aoe76p$ckj$1...@newsg3.svr.pol.co.uk...
> >
> >
> >>Hi, as a newbie to java I downloaded the J2SDK1.4.1 from the Sun site
>
> and
>
> >>installed it as normal. Now I have a java prog I want to compile and
>
> using
>
> >>the javac command everything compiles fine. Then, when I try to execute
> >
> >the
> >
> >>program (even the "hello world" example) I get the following error:
> >
I can't believe I did that! Thanks for the responses anyhow...I'm off to
beat myself up a bit now!
"Jason Teagle" <ja...@teagster.co.uk> wrote in message
news:0eyq9.1069$R07....@newsfep1-win.server.ntli.net...
> LOL! The sad thing is, I knew that fact!!!!!
> Why didn't I realise that?
>
> I can't believe I did that! Thanks for the responses anyhow...I'm off to
> beat myself up a bit now!
Relax, it's all part of the learning curve... bet you won't make that
mistake again {:v)