Your problem is in the definition of 'the current directory'
If you are in the root directory '/' and you have two directories 'dir1' and 'dir2'.
dir1 has a class called Class1 in it and it is packaged as dir1.Class1
dir2 also has its own class packaged as dir2.Class2
If you are still in the root directory and type '
java dir1.Class1', it will execute the Class1 file and the current directory will be the root directory.
If you are still in the root directory and type 'java dir2.Class2', it will execute the Class2 file and the current directory will be the root directory.
If you then change directories to the dir1 directory and type 'java dir1.Class1', it will execute the Class1 file but the current directory is now the dir1 directory.
Likewise, if you are still in the dir1 directory and type 'java dir2.Class2', it will execute the Class2 file but the current directory is
still the dir1 directory.
This is what you are seeing. The AccessFile.java file is never in the directory you run from so it is never in the default directory.
You would have to a) change directories to the same directory as the AccessFile.java file and execute the program b) call AccessFile.java by its absolute name - ie /subdir/AccessFile.java or c) refer to it by its relative path ie ../subdir/AccessFile.java
Dave