aspose file tools*
The moose likes Beginning Java and the fly likes NoClassDefFoundError: MyFirstApp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "NoClassDefFoundError: MyFirstApp" Watch "NoClassDefFoundError: MyFirstApp" New topic
Author

NoClassDefFoundError: MyFirstApp

Lynn DePriest
Greenhorn

Joined: Nov 21, 2005
Posts: 7
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<br /> <br />Imagination bridges the gap between ignorance and understanding!
Lynn DePriest
Greenhorn

Joined: Nov 21, 2005
Posts: 7
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.
Sri Ram
Ranch Hand

Joined: Oct 03, 2005
Posts: 118
Hi,
Take a look at This
Lynn DePriest
Greenhorn

Joined: Nov 21, 2005
Posts: 7
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

Joined: Nov 21, 2005
Posts: 7
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NoClassDefFoundError: MyFirstApp