File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unknown Error!!!!

 
Arun Somasundaram
Ranch Hand
Posts: 63
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am arun.I dont get my jdk working properly.I have tried all the possiblities.I am using the version jdk1.3.1_18.I am having my class file in the directory where I run the "java AdviceClient"(classfilename) command but I get the error as

"Exception in thread "main" java.lang.NoClassDefFoundError: Adviceclient"

I don't know why, so somebody please help me to resolve this problem.

V.S.Arun :
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

Most likely, you've got your CLASSPATH environment variable set, and that setting doesn't include "." (dot), the current directory. Also note that letter case matters: it's either AdviceClient or Adviceclient -- be sure to use whichever is the actual name of the class.

To deal with the CLASSPATH problem, try

java -cp . AdviceClient
 
Arun Somasundaram
Ranch Hand
Posts: 63
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mr.Ernest Friedman-Hill I get the same error.I am correct with all the aspects but I still get the error.I knew very well about CLASSPATH and other basic things.Actaully I am a Java Programmer,but I haven't met with a situation like this ever before.So please try to give me any other solution.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never tell yourself "I am correct with all aspects, but still get the error", because if you're getting an error, then something isn't right.

So the file AdviceClient.class is in the current directory, and you tried the exact command line I showed you?
 
Chris Beckey
Ranch Hand
Posts: 116
Eclipse IDE Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A possibility:
Is AdviceClient in the default package or in another package? If it is in another package then starting from the directory where the class exists will not work as the loader will look in the directory built from the package name.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chris is right that it wouldn't work, but then the error message would say something about "Wrong name" and include the package name.
 
Arun Somasundaram
Ranch Hand
Posts: 63
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mr.Chris Beckey and Mr.Ernest Friedman-Hill for your suggestions.Finally I got by just restaring my pc.After restarting it I just tried it with no hope and unpredictably I got it,I haven't changed any PATHS before restarting the computer.Any how I got it.But this type of misseries happens in the JAVA WORLD.Onething what I was fed up with is I couldn't able to find the reason for the problem.Any way thanks to both of you for spending your time and giving suggestions.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that Java class names are case sensitive. So "AdviceClient" with a capital C is not the same as "Adviceclient" with a lower-case c. Your error message was:

"Exception in thread "main" java.lang.NoClassDefFoundError: Adviceclient"

I don't know if you copy-and-pasted this verbatim from the command prompt or not, but notice that Java was looking for class "Adviceclient" with a lower-case c. If the class was really called AdviceClient, it's not strange that it can't find the class.

You just have to be careful and precise.
Originally posted by Arun Arun:
Onething what I was fed up with is I couldn't able to find the reason for the problem.

Here's a tip: Whenever you get an error like that, copy and paste the error message into Google. This particular error (NoClassDefFoundError) is the number one problem that beginning Java programmers encounter. You could have found the answer very quickly with Google.
[ July 25, 2006: Message edited by: Jesper Young ]
 
Arun Somasundaram
Ranch Hand
Posts: 63
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mr.Jesper Young the class name is Adviceclient.Then how could I able to get the output correctly when I restarted my pc.I am not up to that low level of a begginer.This is not to hurt you but I discuss the problem which I had gone through.I was working with Java for the past 18 months so how could I do this basic mistake.Any way a lot of thanks for your suggestion.I welcome it.
[ July 25, 2006: Message edited by: Arun Arun ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic