Question: In my program I have used the function `FileReader(String fileName)` to read a file. This file is kept at fileName is holding a string `setup.ini`. I have kept this file in the same folder from where I am compiling my java program but even after I have removed the file from this folder I am not getting any Exception of File not found. So I wonder does the compiler take the file from some other location?

Please see the code below:

```
public class ReadINI
{
    public static void main(String args[]) throws IOException
    {
        String s = getParameter("bin","setup.ini");
        System.out.println("Result   " + s);
    }

    public static String getParameter(String inputValue, String fileName)
    {
        try
        {
            BufferedReader myInput = new BufferedReader(new FileReader(fileName));
            try 
            {

                try {
                        String fileLine;
                        fileLine = myInput.readLine();

                        do
                        {
                            String stringArray[] = fileLine.split("=");
                            if (inputValue.equals(stringArray[0]))
                            return stringArray[1];
                        }while ((fileLine = myInput.readLine()) != null); 
                    }
                    catch (Exception e)
                    {
                        System.err.println("Error1: " + e);
                    }
             } // end try
             catch (Exception e)
             {
                 System.err.println("Error2: " + e);
             }

         } // end try
         catch (Exception e)
         {
             System.err.println("failed to open file setup.ini");
             System.err.println("Error3: " + e);
         }
         return "Not Found";
     }

}

```

Answer: 
The compiler doesn't search for your file anywhere. The file is searched for at run time, not at compile time. If you give a relative path, the file will be searched for in the directory where you *run* the program.
Any request to open a file inside a java application makes the JVM start its search from the `CLASSPATH` of that particular java class. So, when you place the file you want to open in code in the `CLASSPATH` - basically the folder in which the .java file (and hence the compiled .class file) resides. Elaborating, if your file `someFile.txt` is to be accessed by `SomeClass` which is residing in package `org.pack1.pack2`, that `someFile.txt` should be present in the folder `\org\pack1\pack2\`

Use of absolute paths to access a file inside an application is discouraged as it would dent the portability of that application.