Results 1 to 10 of 10

Thread: error problem

  1. #1

    Thread Starter
    Junior Member Ezra's Avatar
    Join Date
    Sep 2002
    Location
    northrend
    Posts
    23

    error problem

    i am currently running fedora core 3 and it happens to have java 1.4.2 in it. can someone tell me what does this error mean? i have successfully compiled it free of errors but i can't run it :

    Exception in thread "main" java.lang.NoClassDefFoundError: Average.java
    at gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.5.0.0)
    at _Jv_ThreadRun(java.lang.Thread) (/usr/lib/libgcj.so.5.0.0)
    at _Jv_RunMain(java.lang.Class, byte const, int, byte const, boolean) (/usr/lib/libgcj.so.5.0.0)
    at __gcj_personality_v0 (/home/ezzmir/documents/java.home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre)
    at __libc_start_main (/lib/tls/libc-2.3.3.so)
    at _Jv_RegisterClasses (/home/ezzmir/documents/java.home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre)


    thanks.

  2. #2
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: error problem

    Did you get thouse errors when you ran it in the IDE? If so, are you able to set some break points around, and try to find out what caused it.


    Or if the app is not a big secret you might want to attach the app here, so me or someone else can see if we find out. The error message doesn't tell me much. Sorry.



    ØØ

  3. #3
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Re: error problem

    Yep, that looks like a classpath/path problem, or you are using a crappy IDE like netbeans.

  4. #4
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: error problem

    Quote Originally Posted by System_Error
    Yep, that looks like a classpath/path problem, or you are using a crappy IDE like netbeans.

    I am using NetBeans. At the moment version 4, and I can't complain yet.


    ØØ

  5. #5
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Re: error problem

    Well, just my personal opinion.

  6. #6

    Thread Starter
    Junior Member Ezra's Avatar
    Join Date
    Sep 2002
    Location
    northrend
    Posts
    23

    Re: error problem

    well actually i used the terminal to compile and execute it. it did compile without errors but could not run. or maybe fedora core 3 doesn't have java.io.* class library?

  7. #7
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Re: error problem

    Ok, if it's a runtime exception like that, maybe somethings wrong with your jvm, or your code...Would you mind posting your code?

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: error problem

    How are you calling the program? Do you have any package declarations in the source? Do you have a CLASSPATH environment variable set? What is your directory tree where you have the app?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  9. #9

    Thread Starter
    Junior Member Ezra's Avatar
    Join Date
    Sep 2002
    Location
    northrend
    Posts
    23

    Re: error problem

    the code is just like this :
    Code:
    import java.io.*;
    class Average {
    public static void main(String[]args) throws IOException {
    int num=0, tot=0, ave;
    char gra;
    
    while (num<=10) {
    System.out.println("input grade ");
    gra=(char)System.in.read();
    if(gra=='A')
    tot+=4;
    if(gra=='B')
    tot+=3;
    if(gra=='C')
    tot+=2;
    if(gra=='D')
    tot+=1;
    System.in.skip(2);
    num++;
    }
    ave=tot/num;
    System.out.println("Average grade : "+ave);
    }
    }
    another thing guys. if java is a rather platformless language right, then the way we write the code, compile it and declare anything in it should be the same way regardless of the platform right? thanks.

  10. #10
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: error problem

    How do you call the program? And from where? What's your classpath?

    Java can be quite confusing to get it running the first time.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width