so i developed a java application and trying to read the file in, i get error message saying the file configuration.txt doesnt exist.
here is the file reading code:
public static void main(String[] args) throws FileNotFoundException {
//reading configuration file
Scanner readConfigurationFile = new Scanner(new File("configuration.txt"));
yes, i do have the imported necessary IO library and utilities included.
i moved the file everywhere (in the package, or in the project folder, or the bin folder, etc..) and kept testing, but it didnt work.
the only way it works is when i moved it to the desktop and i put the path of the file on the desktop in the code (so C:\User\....\configuration.txt)
but thats not how i want it, because others have to run it without changing code.
any suggestions/help? i have looked everywhere online and tried different methods but they didnt work. and some would complicate my code so i just avoided.
thanks in advance
System.out.println(new File("configuration.txt").getAbsolutePath());