Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2007

Tip: Looking for answers? Try searching our database.

java.lang.NoClassDefFoundError message even after adding jar to the     classpath!!!

Thread view: 
shivaraj - 12 Dec 2007 05:44 GMT
Hi,

I have a java program which expects a different class (BeanHome.class)
file from a jar. I have added this jar into my classpath. But still I
am getting "java.lang.NoClassDefFoundError: com/test/base/BeanHome"
error. I feel still its something to do with classpath settings.
Please let me know what might be wrong here.
the jar which is having BeanHome class is "service.jar" which is there
in C: drive.
classpath is set using :

set CLASSPATH=%CLASSPATH%;C:\service.jar;

command.

Let me know if I am missing something.
Lew - 12 Dec 2007 06:43 GMT
> Hi,
>
[quoted text clipped - 10 lines]
>
> command.

You don't need that last semicolon.  Also, a drive's root directory is not an
optimal place to put such artifacts.

> Let me know if I am missing something.

So far, the command to run the program.

How did you phrase the command?

Based on indirect evidence, I'm guessing it was something like

java com/test/base/BeanHome

Was that it?

If so, replace the slashes with periods:

java com.test.base.BeanHome

Also, instead of setting CLASSPATH you can also, and often should, use

java -cp %PROJECTROOT%;C:/service.jar com.test.base.BeanHome

Here I'm imagining an envar PROJECTROOT set to the parent directory of com/.

Signature

Lew
This post contains two questions requesting information.

Manfred Rosenboom - 12 Dec 2007 13:05 GMT
Is BeanHome the remote home interface of an EJB?
If yes, you are writing an EJB client. The setup
of the class path depends on which AS you use.
Please tell us, which AS you use.

Best,
Manfred
Roedy Green - 13 Dec 2007 22:11 GMT
On Tue, 11 Dec 2007 21:44:48 -0800 (PST), shivaraj
<shivaraj.malannavar@gmail.com> wrote, quoted or indirectly quoted
someone who said :

>NoClassDefFoundError

it's a beast to track down.  
See
http://mindprod.com/jgloss/runerrormessages.html#NOCLASSDEFFOUNDERROR
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

shivaraj - 17 Dec 2007 08:08 GMT
On Dec 14, 3:11 am, Roedy Green <see_webs...@mindprod.com.invalid>
wrote:
> On Tue, 11 Dec 2007 21:44:48 -0800 (PST), shivaraj
> <shivaraj.malanna...@gmail.com> wrote, quoted or indirectly quoted
[quoted text clipped - 7 lines]
> Roedy Green Canadian Mind Products
> The Java Glossaryhttp://mindprod.com

Hi All,
Thanks for your reply. Though i could not figure out the actual cause
of the problem it got fixed when i used ant framework. I wrote a ant
build file and mentioned this jar with the path and it worked!!! Not
sure what i was missing earlier but its working fine now.
Andrew Thompson - 17 Dec 2007 09:07 GMT
>...Though i could not figure out the actual cause
>of the problem it got fixed when i used ant framework.

That was a good strategy.  I abhor locking important information
into 'some IDE'.  If you have an Ant build file, almost any IDE
worth having, should be able to build the project.

Signature

Andrew Thompson
http://www.physci.org/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.