Java Java Data Structures Efficiency! Custom Serialization

Error: Non static method importFrom cannot be referenced from a static context

here is the main method in Karaoke.java

    public static void main(String[] args) {
        SongBook songBook = new SongBook();
        SongBook.importFrom("songs.txt");
        KaraokeMachine machine = new KaraokeMachine(songBook);
        machine.run();
        System.out.println("Saving book....");
        songBook.exportTo("songs.txt");
    }

and here is the method in SongBook.java

   public void importFrom(String fileName) {
        try (
                FileInputStream fis = new FileInputStream(fileName);
                BufferedReader reader = new BufferedReader(new 
                        InputStreamReader(fis));
        ){
            String line;
            while((line = reader.readLine()) != null) {
                String[] args = line.split("\\|");
                addSong(new Song(args[0], args[1], args[2]));
            }
        } catch (IOException ioe) {
            System.out.printf("Problems loading %s %n", fileName);
            ioe.printStackTrace();
        }
    }

I can't figure out why I am getting this error? when I change importFrom to a static method it requires further methods being changed. It seems like importFrom should not need to be static but I can't figure out what else would cause this error.

1 Answer

Agh... figured it out right after I posted this. I capitalized SongBook when calling the method.