Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

exception in thread main problem  RSS feed

 
oghenekaro EFEKODO
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
need help finding the problem with my code.anything i try running the code it tells exception in thread main.am useing jdk1.5.0_08.please somebody tell me what is wrong and what to do.thanks for your ever listening hears.

my code:


[ October 02, 2006: Message edited by: Gregg Bolinger ]
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The message will be "Exception in thread main: something something something.

It's the "something something something" part that tells you what's going on, along with the stack trace that tells you exactly what line of what file the error occurred on. Please don't make people do all this work for you -- at least tell us what the whole error message is, and what line of code the exception happens on!
 
oghenekaro EFEKODO
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The message is
Exception in thread "main" java.lang.NoClassDefFoundError:Calculator.

thanks again for your ever listening hears.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That means that the JDK can't find the class that you are trying to run. There are a variety of causes for this -

First thing to check is that the classpath contains the path you want. (If you're trying to run a class in the current directory, try "java -classpath . Calculator")


Another thing to look at is if the Calculator class is in a package... in this case you need to go to the directory right above the directory where the package starts and use the full name of the class, including the package. (i.e. if Calculator is in the com.mycompany package, you would go to the directory above the "com" directory and then type "java -classpath . com.mycompany.Calculator")
 
oghenekaro EFEKODO
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your help.i can run my code with ease now.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!