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 error 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 error" Watch "Cannot find symbol error" New topic

Cannot find symbol error

Ugluth Papadopoulos

Joined: Apr 15, 2011
Posts: 7
Hello, I have a pretty weird (to me at least) problem. I had some code for a gumball machine example from a book, and it was working fine. When i tried to implement RMI on it I keep cannot find symbol errors for the main class object gumballMachine. I'm not really sure what code I should post, so I'll post what i think might help you. This program uses the state pattern by the way.

This is the main class

This is the interface my state classes implement

and this is the code i'm using to test it.

The test drive has some more code that tests the machine, but i don't think that is important for my problem.
And my state classes aren't something too much, the only change i made to them was make the gumballMachine object on all of them transient. Here's one of them to get the idea.

I'm getting 27 errors: cannot find symbol at the references of the gumballMachine. Hope the code i posted helps, and sorry for the long post.

Thank you in advance.

Udara Amarasinghe
Ranch Hand

Joined: Aug 17, 2009
Posts: 109

Hi Ugluth,

In the codes you have post there is lot of syntax errors like missing spellings, missing curly brackets and also you have used classes and interfaces that have not declared . try to fix them.
Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051

Please Try to fix others error first.and then post the code here..

SCJP6.0,My blog Ranchers from Delhi
Ugluth Papadopoulos

Joined: Apr 15, 2011
Posts: 7
Hmmm actually i resolved the problem, it was some code that i had in the testdrive class that wasn't supposed to be there. Sorry for the missunderstanding and thank you for your time and replies
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46349
No problem. You can find errors much more quickly if you only write 5 or so lines of code, compile, and start again.
I agree. Here's the link:
subject: Cannot find symbol error
It's not a secret anymore!