aspose file tools*
The moose likes Java in General and the fly likes Unknown Error!!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Unknown Error!!!!" Watch "Unknown Error!!!!" New topic
Author

Unknown Error!!!!

Arun Somasundaram
Ranch Hand

Joined: Jul 25, 2006
Posts: 63
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 :


Arun.V.Somasundaram
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

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


[Jess in Action][AskingGoodQuestions]
Arun Somasundaram
Ranch Hand

Joined: Jul 25, 2006
Posts: 63
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

Joined: Jul 08, 2003
Posts: 24187
    
  34

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

Joined: Jun 09, 2006
Posts: 116

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

Joined: Jul 08, 2003
Posts: 24187
    
  34

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

Joined: Jul 25, 2006
Posts: 63
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

Joined: Aug 16, 2005
Posts: 14352
    
  22

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 ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Arun Somasundaram
Ranch Hand

Joined: Jul 25, 2006
Posts: 63
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
 
subject: Unknown Error!!!!