Re: Beating a Dead Horse: NoClassDefFoundError

From: Tony Morris (_at_dibblegoATbigpond.com@)
Date: 03/28/04


Date: Sun, 28 Mar 2004 07:56:24 GMT


"Andrew Kesterson" <andrew@aklabs.net> wrote in message
news:pan.2004.03.28.07.41.43.116529@aklabs.net...
> I've google-groups'ed the hell out of this and have yet to find anything
> that helps me.
>
> I'm learning java on a Redhat Linux 9.0 system using gcj (javac binary)
> 3.2.2 and gij (java binary) 3.2.2, on an AMD Athlon 2500+, 512mb of RAM.
>
> $ gcj -v
> Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
> Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/libgcj.spec
> rename spec lib to liborig
> Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
> --infodir=/usr/share/info --enable-shared --enable-threads=posix
> --disable-checking --with-system-zlib --enable-__cxa_atexit
> --host=i386-redhat-linux
> Thread model: posix
> gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
>
> $ gij --version
> gij (GNU libgcj) version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
>
> I've been doing java for a couple of days now, and all was working fine;
> and all of a sudden I can't run anything. It gives me cryptic errors, that
> don't appear to relate to CLASSPATH (I've altered it as per so many USENET
> suggestions and still getnothing). The source and program output are
below.
> What has happened here?
>
> $ cat hello.java
> public class hello
> {
> public static void main (String[] args)
> {
> System.out.println("Hello World");
> }
> }
>
> $ javac hello.java
>
> $ java hello.class
> Exception in thread "main" java.lang.NoClassDefFoundError: hello.class
> at 0x40264e17: java.lang.Throwable.Throwable(java.lang.String)
> (/usr/lib/./libgcj.so.3)
> at 0x40257c8e: java.lang.Error.Error(java.lang.String)
> (/usr/lib/./libgcj.so.3)
> at 0x402596b6: java.lang.LinkageError.LinkageError(java.lang.String)
> (/usr/lib/./libgcj.so.3)
> at 0x4025ab36: java.lang.NoClassDefFoundError.NoClassDefFoundError
> (java.lang.String) (/usr/lib/./libgcj.so.3)
> at 0x402a9075: gnu.gcj.runtime.FirstThread.run()
(/usr/lib/./libgcj.so.3)
> at 0x4024bc4c: _Jv_ThreadRun(java.lang.Thread) (/usr/lib/./libgcj.so.3)
> at 0x402188ac: _Jv_RunMain(java.lang.Class, byte const, int, byte
> const, boolean) (/usr/lib/./libgcj.so.3)
> at 0x08048910: ?? (??:0)
> at 0x4069044d: __libc_start_main (/lib/libc.so.6)
> at 0x080486c1: ?? (??:0)
>
> $ env
> CLASSPATH=/usr/src/java (my java development directory, this didn't fix
> it, included here for completeness)
>
> -----------------
>
> Can anyone help me with this? Short of ripping out everything JDK related
> and re-installing from RPMs, I don't know what to do. It was working fine
> and then mysteriously stopped. ?? I didn't change anything that I'm aware
> of.

http://www.xdweb.net/~dibblego/java/faq/answers.html#q8

Remove the ".class" when you invoke the JVM.

-- 
Tony Morris
(BInfTech, Cert 3 I.T., SCJP[1.4], SCJD)
Software Engineer
IBM Australia - Tivoli Security Software
(2003 VTR1000F)


Relevant Pages

  • Re: returning a pair of iterator.
    ... Java is not C++. ... If you don't trust someone with your ... public int getData() ... public class ValuableObject implements ReadableValuableObject {... ...
    (comp.lang.java.programmer)
  • Re: cast to sub-class or extending instance of super or a.n.other
    ... In java, the set of attributes is defined by the class, which is defined at compile-time; when you have an instance, it's runtime, by which point the class definitions are set in stone. ... public class ThingWithMinimumMessageNumber { ... private int minimumMessageNumber; ... public ThingWithMinimumMessageNumber(OriginalThing thing, int minimumMessageNumber) { ...
    (comp.lang.java.programmer)
  • Re: Determining the Main Class
    ... public class Main {public static void method ... In the stack trace above, ... searching the ThreadGroups, and also via Thread.getAllStacktraces. ... you'd have to know the command the java executable was started with to ...
    (comp.lang.java.programmer)
  • Re: Why is String immutable?
    ... the class will fail to load. ... the rules for when the JVM will actually enforce access seem to be ... running java with the "future" argument: ...
    (comp.lang.java.programmer)
  • Re: Cannot clean up Evaluator.java code - errors involving javax.tools.*
    ... I would have respected a request for help to learn polymorphism and other relevant idioms, but not the whining that Java doesn't support evalbecause you think it's too hard to learn what you need to learn. ... Programming is not easy, and there is too much bad code in production for any professional programmer to tolerate intellectual laziness. ... public class Square implements Shape ... private double radius; ...
    (comp.lang.java.help)