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 Cannot find symbol class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Cannot find symbol class" Watch "Cannot find symbol class" New topic

Cannot find symbol class

Shikha Upadhyaya
Ranch Hand

Joined: Aug 17, 2011
Posts: 70

I am new to java. I am trying a simple game with three classes SimpleDotComGame, SimpleDotCom, GameHelper in three different .java files all put together in a directory dotGame. has the main method. I have declared package name as

in each of these files. and compile without any errors. But when I run I get the following error:

I get the same error for SimpleDotCom class as well. Please help me with the same.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10824

package dotGame should be package dotGame; <-- notice the ; at the end.

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Shikha Upadhyaya
Ranch Hand

Joined: Aug 17, 2011
Posts: 70

I have added the semicolon. The error still persists.
Shikha Upadhyaya
Ranch Hand

Joined: Aug 17, 2011
Posts: 70

Hey, I got the solution. The code started working fine when I removed
from all the three classess!

But I didn't get the reason why!
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46345
There is something very peculiar. Replace the package name and use a Scanner to read through the file.
I’ll see if I can create something which will do that.Now copy the entire text of this post into a file; it’s easy enough to do it.
Give it some name like “oddCharacters.txt”.
See whether there are any characters which aren’t standard ASCII. It is possible you have a peculiar character adjacent to the keyword class causing it to be misread.
I agree. Here's the link:
subject: Cannot find symbol class
It's not a secret anymore!