I created a simple file that does not have permission to execute, but when I create a Java File object using this path / file name and then call File.canExecute (), I get the true value as the result, whereas I would expect that this method call to return false. Can someone explain what I'm missing here?
Solaris:
$ touch /tmp/nonexecutable $ ls -l /tmp/nonexecutable -rw-r--r-- 1 root root 0 May 21 07:48 /tmp/nonexecutable
Java:
String pathName = "/tmp/nonexecutable"; File myFile = new File(pathName); if (!myFile.canExecute()) { String errorMessage = "The file is not executable."; log.error(errorMessage); throw new RuntimeException(errorMessage); }
Thanks in advance for your help.
- james
source share