Search code examples
javaeclipsefileprintstream

Where do i find the text file that print stream outputs to?


This is my code for writing to a file using print stream in java

PrintStream stream = null;
        try {
             stream = new PrintStream(new File("hi.txt"));
            stream.println("hi my name is chris");
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        finally{
            stream.close();
        }

My question is after I execute this piece of code, where can I find hi.txt in eclipse? Usually when I am working with text files, the text file appears under JRE system Library. In this case, it doesn't


Solution

  • It should be created in the folder of the Eclipse project you are running.