Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2011
    Posts
    20
    Rep Power
    0

    Default i can compile but not run the program???

    hey hey guys... im sitting here and i have the small problem that i can compile the program but when i run the program it says that there is an error... can you pleas help me??

    class DagTaeller {
    public static void main(String[] argumenter) {
    int årInd = 2003;
    int månedeInd = 12;
    if (argumenter.length > 0)
    månedeInd = Integer.parseInt(argumenter[0]);
    if (argumenter.length > 1)
    årInd = Integer.parseInt(argumenter[1]);
    System.out.println(månedeInd + "/" + årInd + " har " + tælDage(månedeInd, årInd) + " dage.");
    }

    static int tælDage(int månede, int år) {
    int antal = -1;
    switch (månede) {
    case 1:
    case 3:
    case 5:
    case 7:
    case 8:
    case 10:
    case 12:
    antal = 31;
    break;
    case 4:
    case 6:
    case 9:
    case 11:
    antal = 30;
    break;
    case 2:
    if (år % 4 == 0)
    antal = 29;
    else
    antal = 28;
    if ((år % 100 == 0) & (år % 400 != 0))
    antal = 28;
    }
    return antal;
    }
    }

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,457
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by stefandanielsen View Post
    hey hey guys... im sitting here and i have the small problem that i can compile the program but when i run the program it says that there is an error... can you pleas help me??
    If you tell us what exactly the error is and possibly in what part of your code it happened; don't make us guess.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Join Date
    Mar 2011
    Posts
    20
    Rep Power
    0

    Default this is the error :

    Exception in thread "main" java.lang.NoClassDefFoundError: Dagtaeller (wrong name: DagTaeller)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader. java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java :616)
    at java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader .java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader. java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 07)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 48)

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,457
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by stefandanielsen View Post
    Exception in thread "main" java.lang.NoClassDefFoundError: Dagtaeller (wrong name: DagTaeller)
    Read the error message: you mistakenly changed the case of 'taeller'; Java is case sensitive so you'd better save your source code with exactly the same name as the class it defines; run it with exactly the same name again.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    Join Date
    Mar 2011
    Posts
    20
    Rep Power
    0

Similar Threads

  1. Program will not compile?
    By vtecjerry in forum New To Java
    Replies: 1
    Last Post: 09-29-2010, 10:20 PM
  2. my program cannot be compile
    By justlynn in forum NetBeans
    Replies: 8
    Last Post: 08-17-2010, 10:11 AM
  3. My Java program will not compile and run?
    By sabrown311313 in forum Java Applets
    Replies: 1
    Last Post: 09-23-2008, 09:38 AM
  4. Program Won't Compile
    By JavaLovenJoe in forum New To Java
    Replies: 2
    Last Post: 04-22-2008, 01:31 PM
  5. Compile a program
    By toby in forum New To Java
    Replies: 2
    Last Post: 07-30-2007, 09:09 AM

Posting Permissions

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