I am using Eclipse release 3.4.2 and am getting a popup error saying: "Could not find main class. Program will exit."

In the console the error says: "java.lang.NoClassDefFoundError: Inventory" "Exception in thread 'main'"

Is there any other information that would be needed to help with this?

7 Years
Discussion Span
Last Post by NavyMan

Post the code for your class in the code=java code tags and I'll help you solve this error. I've gotten similar errors before as well. If you don't know how to use code tags then read the sticky at the top of this forum.


I found that my .class files had somehow been deleted. No clue how it happened. Luckily I had posted them with my .java files in my class for review and was able to replace them.

About the code tags, when we post an error quote from the console, that is to be in tags as well?


Good question, I'm actually not sure. I'm not a mod - it just makes it very hard to help people if things aren't in those code tags that color, format, and number the code. But yeah, go ahead and put errors in code tags as well.


You had helped me in another post for this same assignment and I noticed the lines you posted were colored. I was able to get the format and line numbers using code=syntax and /code tags but no color in my code. What tags should I be using for that?


As BestJewSinceJC already mention for syntax highlighting you should use code=java
[code=java]System.out.println("Colour Syntax"); [/code] will come as

System.out.println("Colour Syntax");

As for posting errors received from application we leave posting format on you. What is important to as is the use of code tags on posted code (which some people refuse to do and receive pointless infractions and sometimes even ban)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.