Question: Im trying to write a program to read a text file through args but when i run it, it always says the file can't be found even though i placed it inside the same folder as the main.java that im running. 
Does anyone know the solution to my problem or a better way of reading a text file?

Answer: 
When you are opening a file with a relative file name in Java (and in general) it opens it relative to the working directory.

you can find the current working directory of your process using 

```
String workindDir = new File(".").getAbsoultePath()

```

Make sure you are running your program from the correct directory (or change the file name so that it will be relative to where you are running it from).
say I have a text file **input.txt** which is located on the desktop
and input.txt has the following content

```
i came
i saw 
i left

```

and below is the java code for reading that text file

```
public class ReadInputFromTextFile {
    public static void main(String[] args) throws Exception
    {
        File file = new File(
                "/Users/viveksingh/desktop/input.txt");
        BufferedReader br
                = new BufferedReader(new FileReader(file));
        String st;
        while ((st = br.readLine()) != null)
            System.out.println(st);
    }
}

```

output on the console:

```
i came
i saw 
i left

```