?
Solved

NoClassDefFoundError:

Posted on 2003-04-01
9
Medium Priority
?
161 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

743 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