• 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

NoClassDefFoundError: MyFirstApp

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone!

I'm in a bit of a quandary regarding my first shot at programming in Java! I've purchased the Head First Java book and I'm real excited about it, but I've already run into a small problem. I tried creating and running the MyFirstApp application, but when I attempted to run it, I got the following error: Exception in thread "main" java.lang.NoClassDefFoundError: MyFirstApp

All I can tell you is that when I ran the javac compiler, I was able to successfully create a .class file from the .java file, which suggests to me that I've installed Java correctly and that I've successfully added the appropriate location (bin folder) to my Path variable. Maybe such is not the case though or maybe that has nothing to do with it. I can also tell you that when I type java -version, I get 1.5.0_05 returned, which I suppose is okay but I'm not sure. Any help to this newbee would be greatly appreciated.
 
Lynn DePriest
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oops! I guess it would help if I also posted the code that a wrote. There's no way for anyone to know what I may have done if I don't show my work!

public class MyFirstApp {
public static void main (String[] args) {
System.out.println("I Rule!");
System.out.println("The World");
}
}

I checked this against the example in the book, so I have to believe that it is correct, but you never know.
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Take a look at This
 
Lynn DePriest
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SRI RAM!

Thanks very much. I did the Set ClassPath = [blank] command and that did the trick. I'll have to go back now and see why that was causing me trouble. Thanks again for your help.

Lynn
 
Lynn DePriest
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While digging around for information regarding the CLASSPATH, I ran across this on Microsoft's Technet site:

Technet Reference Page

It didn't really apply to my situation (well, not completely anyway) but I thought I would post it just in case anyone might be interested.
 
reply
    Bookmark Topic Watch Topic
  • New Topic