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! Custom Serialization

Crazy error when compiling!

I got this strange error list and wasn't able to get my code to work...

java.io.FileNotFoundException: songs.txt (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at com.teamtreehouse.model.SongBook.importFrom(SongBook.java:38)
at Karaoke.main(Karaoke.java:10)
There are 0 songs available and Exception in thread "main" java.util.MissingFormatArgumentException: Format specifier '%d'
at java.util.Formatter.format(Formatter.java:2519)
at java.io.PrintStream.format(PrintStream.java:970)
at java.io.PrintStream.printf(PrintStream.java:871)
at com.teamtreehouse.KaraokeMachine.promptAction(KaraokeMachine.java:36)
at com.teamtreehouse.KaraokeMachine.run(KaraokeMachine.java:53)
at Karaoke.main(Karaoke.java:12)

here's my code: https://w.trhou.se/cx05w8daj6

any help would be much appreciated :)

1 Answer

Manish Giri
Manish Giri
16,266 Points

Line 10 imports from a file called songs.txt, but it doesn't exist in your workspace, as is mentioned in the error - songBook.importFrom("songs.txt");.