Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Printer class not recognized by PrinterTest
I'm getting exceptions in the provided code that suggest the Printer class is not being recognized by the PrinterTest class. I'm a little out of practice with Java... I haven't changed anything about the provided file structure in the project. Is there something obvious that I'm missing?
~/lcc-java-fp-printer-1.1.0/src/test/java/com/teamtreehouse/challenges/PrinterTest.java Error:(31, 39) java: cannot find symbol symbol: class Printer location: class com.teamtreehouse.challenges.PrinterTest Error:(53, 5) java: cannot find symbol symbol: variable Printer location: class com.teamtreehouse.challenges.PrinterTest Error:(54, 5) java: cannot find symbol symbol: variable Printer location: class com.teamtreehouse.challenges.PrinterTest
Thank you for your time!
Actually, I think I just got it! Maybe a quirk between versions of IntelliJ, but...
When importing the project, the default import options contain:
- [ ] Use Auto Import (default for me: OFF)
- [ ] Create directories for empty content roots automatically (default for me: OFF)
- [ ] Create separate module per set (default for me: ON)
When i imported the file with ON, ON, OFF above, I no longer encountered the issue. I know it's not a very technical solution, but trial and error won out! Testing multiple configurations points to "Create separate module per set" being the root of the issue; with that disabled, the issue is no longer present.
Steps for IntelliJ:
- Download project from treehouse quiz
- Unzip project
- Within IntelliJ, select File > Open > select your project folder
- The Import Project from Gradle pane should pop up without manual selection, then within the pane:
- DISABLE "Create separate module per source set" (critical) ***from my tests, this is the primary source of the issue
- Enable "Use auto-import" (optional)
- Enable "Create directories for empty content roots automatically" (optional)
- Hit OK and you should be able to build your project as provided without exceptions