I've created this simple program in Eclipse:
import java.util.*;
import java.io.*;
public class prob1 {
public static void main(String[] args)
{
try
{
FileReader in = new FileReader("practice.in");
Scanner scanner = new Scanner(in);
while(scanner.hasNext())
{
int number = scanner.nextInt();
if(number==0)break;
int sum = 0;
for (int i=0; i<number; i++)
{
int x = scanner.nextInt();
sum += x;
}
System.out.println("Sum = "+sum);
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
I also have a "practice.in" file in the same folder as this practice.java file is (the src folder in Eclipse."
However, when I try to run it, it can never find it. What is eclipse doing with the paths that I can simply do FileReader("practice.in") when practice.in is in the same directory as the java file? Does this have something to do with my workings directory?