?
Solved

NoClassDefFoundError:

Posted on 2003-04-01
9
Medium Priority
?
162 Views
Last Modified: 2010-03-31
I am trying to call a class which is in a different package from my package and I am getting an error

Debugger Stack Trace Report:

Thread[main,5,main] (Alive)
Uncaught exception (java.lang.NoClassDefFoundError: com.dir1.dir2.dir3.testMds)

     TestHr.testcal()
          this=(t.TestHr) t.TestHr@69cb
     TestHr.main(String [])
          args=([Ljava.lang.String;) [Ljava.lang.String;@3f79
          first=(t.TestHr) t.TestHr@69cb

0
Comment
Question by:Joserip
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 92

Expert Comment

by:objects
ID: 8244320
The package is not in your classpath.

Add the jar to your 'jre/jdk ext directory.
Or add the jar/directory to your classpath.
0
 

Author Comment

by:Joserip
ID: 8244378
Are you saying to go to the control panel and add the
path in the Classpath variable ?

The classpath value has C:\IBMDebug\lib\dertrjrt.jar;

and the class files which I want to use is in c:\programfiles\

I had add the dir path in the classpath value but still I get the error
0
 
LVL 35

Accepted Solution

by:
girionis earned 1000 total points
ID: 8244466
 do this from the command prompt:

  SET CLASSPATH=%CLASSPATH%;c:\programfiles

  and it will set the classpath to point to the programfiles folder as well.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Joserip
ID: 8244888
Thanks ! Sure I shall try it and let you know.
0
 

Author Comment

by:Joserip
ID: 8245164
Thanks ! but it is still have the same error ((java.lang.NoClassDefFoundError: com.dir1.dir2.dir3.testMds))even after setting through  command prompt . I have the .java files in those directories.
0
 
LVL 35

Expert Comment

by:girionis
ID: 8245258
 You need to have the .class files and not the .java files that's what the classpath is for, as name suggests as well. Can you tell me the exact location of your testMds.class file (for example c:\files\myfiles\com\dir1\dir2\dir3\testMds.class)?
0
 

Expert Comment

by:In-D
ID: 8245267
Import is where you have the compiled class-files not the java-files. Try placing the class-files in those directories and try again.
0
 

Expert Comment

by:In-D
ID: 8245272
Important is where you have the compiled class-files not the java-files. Try placing the class-files in those directories and try again.
0
 

Author Comment

by:Joserip
ID: 8246244
Thanks ! I shall try it and get back to you
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question