Java Java Data Structures Efficiency! Custom Serialization

My Karaoke Code gives me a bunch of exception to thread main errors

Hi,

I'm working on this karaoke machine, and all of a sudden, my code stopped working. I have no idea how to post my code, because it's in about 5 files. I deleted some file...stupidly....called SongBook$1.class. The weird thing is, my machine still runs the add, play, and quit options, but when I get to choose, It wont let me choose an artist, it says like 400 cannot read "main" thread or something. As I am writing this, my Karaoke Machine now just decided it doesnt want to open at all.......More exception thread main errors......Please Help!! ;( thanks

Luis Garcia
Luis Garcia
1,552 Points

Hi Gabriel,

What were these errors you were getting?

I'm finally able to compile, I got to the point where the video says "It's alright getting an error the first time the program is run if the serializable file doesn't exists" bu then I'm getting all these errors

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:36)
at Karaoke.main(Karaoke.java:8)
Exception in thread "main" java.util.UnknownFormatConversionException: Conversion = 'i '
at java.util.Formatter$FormatSpecifier.conversion(Formatter.java:2691)
at java.util.Formatter$FormatSpecifier.<init>(Formatter.java:2720)
at java.util.Formatter.parse(Formatter.java:2560)
at java.util.Formatter.format(Formatter.java:2501)
at java.io.PrintStream.format(PrintStream.java:970)
at java.io.PrintStream.printf(PrintStream.java:871)
at com.teamtreehouse.KaraokeMachine.promptAction(KaraokeMachine.java:34)
at com.teamtreehouse.KaraokeMachine.run(KaraokeMachine.java:51)
at Karaoke.main(Karaoke.java:10)

3 Answers

Chris Howell
Chris Howell
Python Web Development Techdegree Graduate 49,485 Points

You will have to post the code. Near the bottom of the page where the Post Answer button is there is a Markdown Cheatsheet this shows you how to mark your text as code and such.

Place 3 backticks ( ``` ) which is below ESC or above TAB on the line above and line below your lines of code. On their own lines. Your code should sit between them.

I actually solved it myself just very recently. Thanks for this tips on how to post my code though!

Luis Garcia
Luis Garcia
1,552 Points

Hi Chris,

I seem to be having the same issues as Gabriel. I've posted a snapshot of my workspace at https://w.trhou.se/6vhykrbgsx. Would you mind having a look at it?

Cheers, LC

Chris Howell
Chris Howell
Python Web Development Techdegree Graduate 49,485 Points

Luis Garcia

Without giving you the answer, the error is occurring on line 34 of KaraokeMachine.java

:)

Luis Garcia
Luis Garcia
1,552 Points

Thanks, Chris. I was able to spot the issue.

Cheers, Luis