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 Data Structures Efficiency! Building the Model

Wolf <null>
Wolf <null>
5,060 Points

Karaoke.java:1: error: cannot access Song import

The workspace keep complaining on bad source file but I have done as the video. Can't figure out what is wrong. (Oh and how do one copy and paste in code the nice way here?)

"Karaoke.java:1: error: cannot access Song
import com.teamtreehouse.model.Song;
^
bad source file: ./com/teamtreehouse/model/Song.java
file does not contain class com.teamtreehouse.model.Song
Please remove or make sure it appears in the correct subdirectory of the source path."

alt text

edit It worked after an hour of waiting, the Workspace was very slow to update the changes.

3 Answers

Wolf <null>
Wolf <null>
5,060 Points

If I knew how to post pictures in this forum it would be easier to show. (can't find information on how to do it, the markdown cheatsheet is just cluttered with text)

You can copy and paste the code as test; that works fine. But, the markdown allows pictures as links which is impossible to copy into here! Stick to copy/paste.

One issue is with SongBook.java - what includes have you got in there? There may be other issues, but let's start with that one!

Steve.

Daniel Muchiri
Daniel Muchiri
15,407 Points

Hi Wolf, I had the same error. I figured it out after 3 hours... The error was that I forgot to declare the class properly in the Song.java file.

BEFORE: public Song { // my awesome code }

AFTER CORRECTION: public class Song { // my awesome code }

just forgetting to write the name: "class" gave me a million errors!! I felt very silly.

Hope this helps.