Scanner in = new Scanner(System.in); System.out.println("Enter file path"); String s = in.nextLine(); //C:\\testing.txt br = new BufferedReader(new FileReader(s)); // And to use that file path in the FIleReader use like this;