Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2011
    Posts
    3
    Rep Power
    0

    Unhappy ClassNotfoundException

    I'm a novice at programming and Java. So i really need the ABC of java! I've got jdk1.6.0_21 on my system and i use windows 7 OS. Trouble is i can't run any of the java programs that i write. I am able to compile but not run them. The programs are free of errors. All i get during runtime is a ClassNotFoundException. Would be glad if someone helps me with this! Thanks!

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

    Default Re: ClassNotfoundException

    Show us the very first line of your source code; I bet your class is stored in a package while you don't know how packages are handled by the JVM.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Join Date
    Oct 2011
    Posts
    3
    Rep Power
    0

    Default Re: ClassNotfoundException

    Jos, Its a simple hello world program! Just seven lines! :( Do you think I should set my path variables?

  4. #4
    Join Date
    Oct 2011
    Posts
    3
    Rep Power
    0

    Default Re: ClassNotfoundException

    This is what I get everytime I try to run a program on the console.


    D:\Program Files (x86)\Java\jdk1.6.0_21\bin>java ex
    Exception in thread "main" java.lang.NoClassDefFoundError: ex
    Caused by: java.lang.ClassNotFoundException: ex
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 202)
    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)
    Could not find the main class: ex. Program will exit.

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,535
    Blog Entries
    7
    Rep Power
    20

    Default Re: ClassNotfoundException

    Quote Originally Posted by shirleympearls View Post
    This is what I get everytime I try to run a program on the console.


    D:\Program Files (x86)\Java\jdk1.6.0_21\bin>java ex
    Exception in thread "main" java.lang.NoClassDefFoundError: ex
    Check if a file ex.class exists in the directory where you want to run it. (funny name "ex", I would've expected something like HelloWorld or similar).

    kind regards.

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. ClassNotFoundException...
    By providence in forum JDBC
    Replies: 2
    Last Post: 02-02-2011, 06:45 PM
  2. ClassnotFoundException
    By balaji shan in forum Java Servlet
    Replies: 8
    Last Post: 01-19-2011, 03:47 PM
  3. ClassNotFoundException
    By meprasobh in forum New To Java
    Replies: 2
    Last Post: 10-17-2010, 03:32 PM
  4. classNotFoundException
    By jyothi.priyanka in forum NetBeans
    Replies: 5
    Last Post: 08-24-2010, 10:13 AM
  5. ClassNotFoundException
    By oontvoo in forum Java Applets
    Replies: 7
    Last Post: 05-13-2010, 11:09 PM

Posting Permissions

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