File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Exception in thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Exception in thread "main"!" Watch "Exception in thread "main"!" New topic

Exception in thread "main"!

Scott Mahoney

Joined: Jan 10, 2008
Posts: 3
Hey everyone,

I'm working through the book Head First Java, and I'm having problems getting some of the code to run. It compiles without error, but when I run the class I get this:

Any ideas on how to fix this? I'm thinking I probably don't have something installed properly. I've tried this code on three different computers now, all Windows machines, and I get the same error. If I need to post the program code to help, let me know; I just didn't want to make the post overly long.

marc weber

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Scott Mahoney: game (wrong name: chap5/Game)..

First, Java is case sensitive, so "game" is not the same as "Game." But it also looks like your Game class is in a package (and hopefully a directory) called "chap5."

In this case, the qualified name of the class is really "chap5.Game" which is in the parent directory of "chap5."

So to run this, set the current directory to the parent of the "chap5" directory, and then run with...

...Parent>java chap5.Game

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
I agree. Here's the link:
subject: Exception in thread "main"!
It's not a secret anymore!