• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

can anyone explain this error?

 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I keep getting this error if I try to run a java file from a command prompt under Win2k.
Exception in thread "main" java.lang.NoClassDefFoundError: dog/java
I've updated my path settings for my jdk and when I run the file in Forte, it works fine. However, I can't get it to work from the command prompt. And I have done cd c:\forte4j\Development which is where the file is before trying to run it Thanks!
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Error message is because it is not able to find the class file.You must first set the class path.
c:\set classpath=%CLASSPATH%;c:\DirName;
Where DirName is the name of the directory under which
your class file is generated.
Or you can run your program from that the directory in which your class file is stored,in this case you will not have to set the class path.
 
tyler jones
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's what I originally said I did if I'm not mistaken.

Originally posted by tyler jones:
And I have done cd c:\forte4j\Development which is where the file is before trying to run it Thanks!


Am I incorrect? If so, I guess I'm not following you.
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This looks like one I do a lot! Are you sure you're trying to run the class file and not the java file?
i.e. 'java dog'
rather than 'java dog.java'
(with whatever class-path and other options).
The error message suggests it's looking for a file called java in the dog package.
Hope this helps
Kathy
 
tyler jones
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That must have been it cause it worked like a charm. Duh. Okay, thanks a lot! By the way...I would like to learn Java well enough to be certified and currently I am using Forte to do my coding and compiling in. Should I not do this or does it not matter when it comes to the exam? I'm not sure if I'm hurting myself in the long run by using an IDE. Thanks again.
 
Kathy Rogers
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry - I don't know anything about Forte. I've used VisualAge and TextPad. VisualAge is good for generating quite complicated code quickly - but it generates a lot of the code / code structure for you and takes away a lot of the thinking - for example, you select from available methods / attributes when creating the GUI so you don't really have to know your awt/swing that well. If Forte's like that, I would try and do a lot by basics. Textpad does some nice stuff for you but basically you write all the code and you have to know where to import stuff and what methods/attributes are available. If Forte's like that, I wouldn't worry too much.
Having said all that, learning Java's quite difficult so if you're starting out, you might be better to focus on one development environment, whichever you're most comfortable with, and worry about adding another one later.
Kathy
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i think u are trying to run a java file.
U shouldn't run a java file with JAVA command.
run the class using JAVA command.
That sort of error occurs only when u tried a code like this,
java test.java
instead u should type,
java test
where test is the class name.
and remember don't use the file name while running the JAVA program, use only class name.
 
If I had asked people what they wanted, they would have said faster horses - Ford. Tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic