Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

running problem

 
Pradyut Bhattacharya
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
classpath=C:\jdk1.3\lib;C:\j2sdkee1.2.1\lib\j2ee.jar
path=C:\jdk1.3\bin;C:\j2sdkee1.2.1\bin

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
Pradyut
 
Julian Kennedy
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 package.xyz"
  • If you post a specific error it's easier to diagnose the problem

  • Hope this helps.

    Jules
     
    Shashank Agarwal
    Ranch Hand
    Posts: 105
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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[]
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic