This is my current code
public static void readText() throws FileNotFoundException {
Scanner scan = new Scanner(new File("D:\\BookList\\src\booklist\\Booklist.txt"));
while(scan.hasNextLine()){
String line = scan.nextLine();
System.out.println(line);
}
}
it works fine put it specifies the d drive(it is stored on a usb) and no other folders.
Users could save it anywhere, and the filepath would theoretically be different every time, so my question is how do i start from the Booklist project folder that the program exists in, vs the drive of the comptuer, folders leading up to the project folder(if any), and then in the project folder, to find my file for my program to use.