It's not a secret anymore!
The moose likes Beginning Java and the fly likes running problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "running problem" Watch "running problem" New topic

running problem

Pradyut Bhattacharya
Ranch Hand

Joined: Aug 12, 2004
Posts: 63
i'm using jdk 1.3 with windows 2000 professional. i have set the path and the classpath in environment variables.
i can use javac very conviniently
but every time i java a program, for example
java xyz
i get the message
Exception in thread "main" java.lang.NoClassDefFoundError: xyz

my details for path and classpath are

i have used many programs earliear and they worked fine
but this a new problem. i tried using both old and new class files.

please help

Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Hi Pradyut,

A few suggestions:
  • Try adding . (the current directory) to your classpath
  • You've added the c:\jdk1.3\lib directory, but if you need any specific JARs in your classpath which are not part of the platform you'll need to add them individually (by name)
  • If your class "xyz" is in a package you need to run it using "java"
  • If you post a specific error it's easier to diagnose the problem

  • Hope this helps.

    Shashank Agarwal
    Ranch Hand

    Joined: May 20, 2004
    Posts: 105
    Try setting path for only one jdk. or else look up your code, u must have a "public static void main(String args[])" inside ur main class
    if this is not there, u'll get the main class not found exception

    Remeber the String args[]
    I agree. Here's the link:
    subject: running problem
    It's not a secret anymore!