Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java Below where it is bolded . I am having trouble having the system find the f

ID: 3749958 • Letter: J

Question

Java

Below where it is bolded. I am having trouble having the system find the file.

I am using a windows computer.

Location of ac_matrix file.

- "C:\uwexfs02.virtuallab.local\UEMprofiles\sever2845\Home\Downloads\homework_02

ERROR given:

java.io.FileNotFoundException: C:uwexfs02.virtuallab.localUEMprofilessever2845HomeDownloadshomework_02c_matrix (The system cannot find the path specified)

CODE:

public static void main(String[] args) {

AccessControl ac = new AccessControl();

//fileName + Path

ac.load("C:\uwexfs02.virtuallab.local\UEMprofiles\sever2845\Home\Downloads\homework_02\ac_matrix");

System.out.println(ac);

Scanner in = new Scanner(System.in);

Explanation / Answer

Sir, the main cause of error is that the compiler is unable to get the file at the path you specified. There can be 2 reasons:

What you can do is check and provide the correct path. Or you can paste the file to be used in the same location where your .java file is placed and nistead of provising the full path of the file, just provide the name of the file. That will do fine.

Then your code will look like:

public static void main(String[] args) {

    AccessControl ac = new AccessControl();

    //fileName + Path

    // paste the file ac_matrix in the same folder or location as the .java file

    // assuming the extension of the file is .txt

    // change the extension as per your file

    ac.load("ac_matrix.txt");

    System.out.println(ac);

    Scanner in = new Scanner(System.in);

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote