javac responds with "not a file" but the file exists

cvifli :

When I compile one Java file with javac, it responds with the error not a file (instead of file not found):

enter image description here

So I tried to compile it in the WSL environment and it compiles the same file fine. Then, I realized that it may be because I put the file under OneDrive, so I moved it out of OneDrive and tried it again, and then javac worked:

enter image description here

After that, I created an empty java file under Onedrive and tried again, which also shows the not a file error:

enter image description here

Then, I started to realize that when I "dir" in PowerShell, the mode of files under OneDrive include one "l" symbol, which represents "reparse point". Although I do not really understand what it means, I am curious whether it is because of the l that I can not compile the java file. Or if is there any other potential problems.

MondKin :

In the first image you posted you can see this:

> dir
Mode     Name
-a---l   helloworld.java

So, what that l at the end of the mode means is that helloworld.java is not a file, it's a symlink. And that's what javac is telling you.

The example you posted in the second image works because that one is actually a file (see the Mode column says -a----).

The problem is caused by OneDrive, it seems what we see as files are not actually the files but links that point to those files. To avoid the problem, don't place your java files inside the OneDrive folder.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=472120&siteId=1