简体   繁体   English

终端与Eclipse PosixFilePermissions

[英]Terminal vs Eclipse PosixFilePermissions

By running the same command from the Eclipse and from the command line I get 2 different results: 通过从Eclipse和命令行运行相同的命令,我得到2个不同的结果:

With Eclipse everything works fine, however with the command line I get the following error message: 使用Eclipse,一切正常,但是在命令行中,我收到以下错误消息:

PosixThing.java:17: error: error while writing PosixThing: PosixThing.class (Permission denied)

This error message does not appear if I run " sudo javac PosixThing.java". 如果我运行“ sudo javac PosixThing.java”,则不会出现此错误消息。 As it if was not strange enough, the same code with a different file located in the same directory (Desktop) does not give me any problem. 因为它还不够奇怪,所以位于同一目录(桌面)中的具有不同文件的相同代码不会给我带来任何问题。 (I am talking about mere txt files just to test the PosixFilePermissions function). (我在谈论仅用于测试PosixFilePermissions函数的txt文件)。

I checked the file permissions and everything is -rw -rw -rw As well as the others'. 我检查了文件权限,所有内容都是-rw -rw -rw以及其他文件。 Do not know why it happens only with that specific file. 不知道为什么仅在该特定文件中会发生这种情况。 Running on Ubuntu 11.10 jdk 1.7. 在Ubuntu 11.10 jdk 1.7上运行。

Any suggestion to what it might be? 有什么建议吗?

It sounds like a file / filesystem permissions problem of some kind: 听起来像是某种文件/文件系统权限问题:

  • Check the owner, group and permissions for the file, and all directories on the file pathname. 检查文件的所有者,组和权限,以及文件路径名上的所有目录。

  • Check that you are running Eclipse and your command shell as the same effective user. 检查您是否以同一有效用户身份运行Eclipse和命令外壳程序。

  • Check that you are not attempting to write to some kind of "funky" file system; 检查您是否没有尝试写入某种“笨拙的”文件系统; eg a Windows file system mounted on Linux, or a FUSE file system of some kind. 例如安装在Linux上的Windows文件系统或某种FUSE文件系统。

  • If you've got SELinux enabled, check that's not causing the problem. 如果您已启用SELinux,请检查是否未引起此问题。 (That's unlikely.) (不太可能。)

It is also possible that you are running different releases / versions of Java in the two contexts, or even that Eclipse's file system cache is out of sync. 也有可能在两个上下文中运行不同的Java版本/版本,或者甚至Eclipse的文件系统缓存不同步。 (It is not clear to me what contexts the code is actually running in.) (我不清楚代码实际在什么上下文中运行。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM