```
String[] cmd = {
                "/bin/bash",
                "-c",
                "python count_freqs.py gene.train > gene_counts2.txt",
        };
        Runtime.getRuntime().exec(cmd);
        bufferReader.close();
        fileReader.close();
        FileReader fileReader2 =  new  FileReader("/home/mordor/workspace/GeneNamesInBiologicalText/gene_counts2");
        String newLine ;
        try (BufferedReader br = new BufferedReader(new FileReader("/home/mordor/workspace/GeneNamesInBiologicalText/gene_counts2.txt"))) {
            String line1;
            while ((line1 = br.readLine()) != null) {
              System.out.println(line1);
            }
        }*/

```

I used the *String cmd[]* to build a script to create a file called *gene\_Counts2.text* which it successfully does and it's populated with a lot of text.

But when I use a *filereader* and *bufferreader* to iterate through the text and print it, it doesn't happen cause line1 from the code is null.

However once the program has finished running I tried iterating through the file and it works.

So how do I access the contents of the file without having to restart my program?