• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unknown Error!!!!

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 :
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 116
Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic