Results 1 to 5 of 5

Thread: Newbie Java Programing Problem *Resolved*

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Posts
    4

    Newbie Java Programing Problem *Resolved*

    Ok im REALLY new to Java like i cant get my first 2 programs FROM a BOOK to work. Here they are:

    BigDebt.java

    class BigDebt {
    public static void main(String[] arguments) {
    int debt = 59000000;
    debt = debt / 1440;
    System.out.println("A Minutes Worth Of Dedt Is: $" + debt);
    }
    }

    Root.java

    class Root {
    public static void main(String[] arguments) {
    int number = 255;
    System.out.println("The square root of"
    + number
    + " is "
    + Math.sqrt(number));
    }
    }

    now ive compiled them error free and yet when i goto run the class file in Dos i get this message:

    Exception in thread "main" Java.lang.NoClassDefFoundError: Root/class

    and thats it.....can ANYONE Help? ive even been on the tutorials from Sun and copy and pasted the hello world program and i have the same error come up
    Last edited by gmoney; Aug 31st, 2003 at 07:42 AM.

  2. #2
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    this works for me
    Code:
    'save as BigDebt.java
    
    class BigDebt 
    {
       public static void main(String[] arguments) 
       {
          int debt = 59000000;
          debt = debt / 1440;
          System.out.println("A Minutes Worth Of Debt Is: $" + debt);
       }
    }
    Output was: A Minutes Worth Of Debt Is: $40972

    this one also worked
    Code:
    'Save as Root.java
    
    class Root 
    {
       public static void main(String[] arguments) 
       {
          int number = 255;
          System.out.println("The square root of  "
                              + number
                              + " is "
                              + Math.sqrt(number));
       }
    }
    Output was: The square root of 255 is 15.968719422671311
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Posts
    4
    i copied ur pasted code and then recompiled them and am still having no luck, i am running out of ideas

  4. #4
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    just curious and this may sound stupid but, are you compiling and executing them correctly???
    since java is case sensitive.
    Code:
    javac BigDebt.java 'compile it
    
    java BigDebt 'execute it
    
    javac Root.java 'compile it
    
    java Root 'execute it
    if you are doing the above correctly, what is the error message you are getting?
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  5. #5

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Posts
    4
    ok i have figured out the problem, i was adding the file extensions in when i went to run the class files. so i would type:

    java Root.class

    and not

    java Root

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