I'm not sure, about how you want to access your input file. As far as I know, there is no eclipse feature, that allows using files as System.in
. (see Eclipse reading stdin (System.in) from a file )
I tried to reproduce your eclipse setup (as posted in your comment) and built a simple program, that outputs every line of the input.
Java8:
public class Main {
public static void main(String[] args) throws IOException, URISyntaxException {
// get resource from classpath
URL resource = ClassLoader.getSystemResource("quickfind/largeUF.txt");
Path path = Paths.get(resource.toURI());
// read all lines
List<String> allLines = Files.readAllLines(path);
// print all lines
allLines.stream().forEach(System.out::println);
}
}
Java7:
public class Main {
public static void main(String[] args) throws IOException, URISyntaxException {
// get resource from classpath
URL resource = ClassLoader.getSystemResource("quickfind/largeUF.txt");
Path path = Paths.get(resource.toURI());
// read all lines
List<String> allLines = Files.readAllLines(path);
// print all lines
for (String line : allLines) {
System.out.println(line);
}
}
}