[英]Permmission denied while opening file from Temp folder
In my Temp
folder, there is one file which is downloaded from browser. 在我的
Temp
文件夹中,有一个文件是从浏览器下载的。 I am trying to open this file using Desktop
API like this : 我正在尝试使用
Desktop
API这样打开此文件:
File f = new File("C:/DOCUME~1/NJAGAD~1/LOCALS~1/Temp/7870249-0/1234567.pptx");
try {
Desktop.getDesktop().open(f);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
But it gives error like : 但是它给出了如下错误:
java.io.IOException: Failed to open file:/C:/DOCUME~1/NJAGAD~1/LOCALS~1/Temp/7870249-0/1234567. Error message: Access is denied.
at sun.awt.windows.WDesktopPeer.ShellExecute(Unknown Source)
at sun.awt.windows.WDesktopPeer.open(Unknown Source)
at java.awt.Desktop.open(Unknown Source)
I had the same issue and got the error java.io.IOException: Failed to open "PDF" files. 我遇到了同样的问题,并收到错误java.io.IOException:无法打开“ PDF”文件。 Error message: Access is denied.
错误消息:访问被拒绝。 The following solution resolved the issue.
以下解决方案解决了该问题。
Solution: 解:
Open the PDF reader Go to Edit --> Preferences General --> Select Default Handler --> Select Adobe product --> apply -->ok --> Restart the computer 打开PDF阅读器转到“编辑”->“首选项常规”->选择“默认处理程序”->选择“ Adobe产品”->“应用”->“确定”->重新启动计算机
If you want to access folders in windows partition you have to change permission. 如果要访问Windows分区中的文件夹,则必须更改权限。 Otherwise you will get this exception.
否则,您将获得此异常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.