I've tried to open a file, using a relative path, with my file is located in the root folder of my project.
BufferedReader reader = new BufferedReader(new FileReader("text.h"));
That didn't work.
So I printed the working directory, but this leads me to the directory in which eclipse is installed.
System.out.println(new File(".").getAbsolutePath());
My project structure:
Project
--bin
--core
text.h
--src
text.h
--com
--home
--core
Main.java
text.h
--editor
--ui
text.h
I've copied the text file in different locations, inside the my project directory and I've tried different paths, but none has worked.
If I copy the file inside the directory where Eclipse is installed, then I can read the file with the following path.
BufferedReader reader = new BufferedReader(new FileReader("text.h"));
How can I read the file from the root folder of my project ?