I need to get the absolute path of one of my directories. So I clicked on properties to grab that absolute path and had in my code:
Scanner sc = new Scanner(System.in);
public void Find(String path) {
System.out.println("Enter in location");
path = sc.nextLine();
try
{
File inputFile = new File(path);
Scanner reader = new Scanner(inputFile);
}
catch(FileNotFoundException e)
{
System.out.println("Try again file not found");
}
}
I'm trying to get the absolute path of the directory through user input, so I enter in the absolute path of the directory through user input by calling the class in the main method and I get:
Enter in location of file
C:\Users\Trevor's PC\Documents\NetBeansProjects
Try again file not found
So something must be off with my class or the way I'm trying to read it in?