Results 1 to 10 of 10
- 07-12-2012, 09:53 PM #1
Senior Member
- Join Date
- Jul 2012
- Posts
- 165
- Rep Power
- 1
Exception in thread main java.lang.NoClassDefFoundError
I am new to java programming, it is also the first ever language I have tried to learn so am very new at debugging.
I have compiled my simple program perfectly fine, I got the class file output as normal, however I have a run-time issue. I get the following message:

What is wrong, how do I fix it?
This is my source code:
Java Code:class Operators { public static void main(String[] args) { double first = 4.0; double second = 6.0; System.out.println("The first value equals " + first); System.out.println("The second value equals " + second); System.out.println(" "); System.out.print("These two values added together equals "); System.out.println(first + second); System.out.print("The second value minus the first equals "); System.out.println(second - first); System.out.print("The product of these two values "); System.out.println(first * second); System.out.print("The second value divided by the first equals "); System.out.println(first / second); } }
Thanks for reading
- 07-12-2012, 09:55 PM #2
Senior Member
- Join Date
- Jul 2012
- Posts
- 165
- Rep Power
- 1
Re: Exception in thread main java.lang.NoClassDefFoundError
Updated code, same issue:
Java Code:class Operators { public static void main(String[] args) { double first = 4.0; double second = 6.0; System.out.print("The first value equals "); System.out.println(first); System.out.print("The second value equals "); System.out.println(second); System.out.println(" "); System.out.print("These two values added together equals "); System.out.println(first + second); System.out.print("The second value minus the first equals "); System.out.println(second - first); System.out.print("The product of these two values "); System.out.println(first * second); System.out.print("The second value divided by the first equals "); System.out.println(first / second); } }
- 07-12-2012, 10:10 PM #3
Student
- Join Date
- Jul 2012
- Location
- United States
- Posts
- 328
- Rep Power
- 1
Re: Exception in thread main java.lang.NoClassDefFoundError
It says at the very top next to the error:
Does that help?Java Code:(wrong name: Operators)
"Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill
- 07-12-2012, 10:21 PM #4
Senior Member
- Join Date
- Jul 2012
- Posts
- 165
- Rep Power
- 1
Re: Exception in thread main java.lang.NoClassDefFoundError
Can't I use "Operators" as the class name then?
Is it a keyword?
- 07-12-2012, 10:22 PM #5
Student
- Join Date
- Jul 2012
- Location
- United States
- Posts
- 328
- Rep Power
- 1
Re: Exception in thread main java.lang.NoClassDefFoundError
Double check exactly what you typed into the command line.
"Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill
- 07-12-2012, 10:24 PM #6
Senior Member
- Join Date
- Jul 2012
- Posts
- 165
- Rep Power
- 1
Re: Exception in thread main java.lang.NoClassDefFoundError
OMG!
It was just because I typed "operators" instead of "Operators"?!
- 07-12-2012, 10:27 PM #7
Student
- Join Date
- Jul 2012
- Location
- United States
- Posts
- 328
- Rep Power
- 1
Re: Exception in thread main java.lang.NoClassDefFoundError
Yes.
"Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill
- 07-12-2012, 10:28 PM #8
Senior Member
- Join Date
- Jul 2012
- Posts
- 165
- Rep Power
- 1
Re: Exception in thread main java.lang.NoClassDefFoundError
haha, thanks for your help.
I thought it was more complex than that.
So the compiler doesn't need capitals but the VM does?
- 07-12-2012, 10:34 PM #9
Student
- Join Date
- Jul 2012
- Location
- United States
- Posts
- 328
- Rep Power
- 1
Re: Exception in thread main java.lang.NoClassDefFoundError
Apparently so. I didn't realize the compiler didn't require it, so thank you for that information.
I always assume that everything is case-sensitive just as a precaution!"Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill
- 07-16-2012, 03:42 AM #10
Re: Exception in thread main java.lang.NoClassDefFoundError
My API:Java Code:cat > a.out || cat > main.class
Similar Threads
-
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/star/lang/XEventLi
By baktha.thalapathy in forum New To JavaReplies: 5Last Post: 06-02-2010, 01:05 PM -
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/star/lang/XEventLi
By baktha.thalapathy in forum Advanced JavaReplies: 3Last Post: 06-01-2010, 03:01 PM -
Exception in thread "main" java.lang.NoClassDefFoundError: client
By fithous in forum New To JavaReplies: 1Last Post: 04-02-2009, 09:50 PM -
Exception in thread "main" java.lang.NoClassDefFoundError: client Help
By b000m in forum New To JavaReplies: 6Last Post: 08-18-2008, 06:44 AM -
Exception in thread "main" java.lang.NoClassDefFoundError
By baltimore in forum New To JavaReplies: 1Last Post: 08-06-2007, 06:07 AM


2Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks