Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Objects (Retired) Harnessing the Power of Objects Methods and Constants

Nathan Sass
Nathan Sass
3,507 Points

"ERROR: cannot find symbol" when trying to initialize a new instance of PezDispenser in the repl

I tried re compiling my file to see if I had a syntax error but it was fine. It just doesnt seem to work in the repl.

3 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Nathan;

Can you post your code and your error message, please?

Thanks,
Ken

Nathan Sass
Nathan Sass
3,507 Points

I was able to get it working when I removed the comments in my code. For some reason, the repl does not work when there are comments in the code. Any idea why?

Andrew Wiley
Andrew Wiley
27,097 Points

Make sure you are adding the : before the load like this " :load PezDispenser.java "

As Nathan said, the issue is the comments. I had the exact same problem, and it was solved when I removed the comments.

As Nathan and Anne said, if you have comments you're going to get an error ""ERROR: cannot find symbol" if you have comments in your code.

That's just shoddy coding on Treehouse's part TBH. I have notes because this section is pretty brutal to new coders so losing them isn't cool :)