javac以“不是文件”作为回应但文件存在 [英] javac responds with "not a file" but the file exists

查看:187
本文介绍了javac以“不是文件”作为回应但文件存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用javac编译一个Java文件时,它以错误响应而不是文件(而不是找不到文件):

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

所以我试图在WSL环境中编译它并编译相同的文件。然后,我意识到这可能是因为我把文件放在OneDrive下,所以我将它移出OneDrive并再次尝试,然后 javac 工作:

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:

之后,我在Onedrive下创建了一个空的java文件再次尝试,这也显示不是文件错误:

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

然后,我开始意识到当我在PowerShell中dir时,OneDrive下的文件模式包含一个l符号,表示重新分析点 。虽然我不太明白这意味着什么,但我很好奇是否因为 l 我无法编译java文件。或者是否还有其他潜在问题。

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.

推荐答案

在您发布的第一张图片中,您可以看到:

In the first image you posted you can see this:

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

所以,模式结束时 l 的含义是 helloworld.java 不是文件,它是符号链接。这就是 javac 告诉你的。

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.

你在第二张图片中发布的例子是有效的,因为那个实际上是一个文件(参见Mode列说 -a ---- )。

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

问题是由OneDrive引起的,看起来我们看到的文件实际上并不是文件,而是指向那些文件的链接。要避免此问题,请不要将您的java文件放在OneDrive文件夹中。

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.

这篇关于javac以“不是文件”作为回应但文件存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆