Java 小程序无法在 Safari 7 (Mac OS X 10.9) 下打开文件 [英] Java applet can't open files under Safari 7 (Mac OS X 10.9)

查看:20
本文介绍了Java 小程序无法在 Safari 7 (Mac OS X 10.9) 下打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个 Web 应用程序,它使用 Java 小程序来操作本地磁盘上的文件.我们开发它已经有一段时间了,我们已经知道小程序在现代操作系统和浏览器以及最新的 Java 版本和新的安全限制中可能会遇到的所有类型的问题.

We have a web app that uses Java applet to manipulate files on local disk. We develop it for quite a while and we already know all types with issues an applet may have with modern OS'es and browsers and latest Java versions and new security restrictions.

昨天,Apple 推出了带有新 Safari 浏览器 (7.0) 的新 Mac OS 10.9 Mavericks.我在 Safari 7/Mac OS X 10.9 下测试了我们的网络应用程序,只是为了发现 Safari 7(可能?)阻止从 Java 小程序访问本地文件.

Yesterday Apple rolled out its new Mac OS 10.9 Mavericks with new Safari browser (7.0). I tested our web app under Safari 7 / Mac OS X 10.9 just to find that Safari 7 (probably?) blocks access to local files from Java applet.

尽管小程序(使用有效的 Thawte 证书签名,并满足 Java 7u45 特定的所有安全要求)以无限制模式运行,具有对本地文件系统的完全访问权限(Java 安全提示说明了这一点),但在尝试访问本地文件时它捕获 fileNotFoundException:

Although the applet (signed with valid Thawte certificate, and with all security requirements specific to Java 7u45 fulfilled) runs in unrestricted mode with full access to local file system (Java security prompt says that), on attempt to access the local file it catches fileNotFoundException:

java.io.FileNotFoundException: /Users/yury/Pictures/Paris 2012/L1050258.jpg (Operation not permitted)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:146)
    at com.trackntag.a.v.a(Unknown Source)

此外,当从小程序打开 Java 文件打开对话框时,它不显示任何文件,并且文件夹选择器中的文件夹没有任何图标(通常应该有它们).遍历回根文件夹,可以看到顶级文件夹(bin、cores、dev、home等),但无法浏览.

Also when opening Java file open dialog from the applet, it displays no files and the folders in the folder selector do not have any icons (normally they should have them). When you traverse back to the root folder, you can see top level folders (bin, cores, dev, home, and so on), but you cannot browse into them.

在同一台机器(Java 7u45,Mac OS X 10.9)上,小程序确实可以使用最新的 Firefox 24 for Mac 访问本地文件.与 Safari 6 和 Mac OS X 10.8.5 相同,更不用说各种配置的 Linux 和 Windows 机器:访问本地文件没有问题.

The applet does have an access to local files with latest Firefox 24 for Mac, on the same machine (Java 7u45, Mac OS X 10.9). Same with Safari 6 and Mac OS X 10.8.5, not to mention Linux and Windows machines in various configurations: no issues with accessing local files.

综上所述,我必须得出结论,我们遇到了 Safari 7 特有的问题.

Having all of above, I must conclude that we have ran into the problem specific to Safari 7.

您对这个问题有什么想法吗?任何想法都非常感谢.

Do you have any ideas on this issue? Any thoughts are greatly appreciated.

干杯,尤里

编辑(答案):在 Safari 7 中有一个新的安全设置:安全/不安全模式(我认为它仅适用于 Java 插件).您可以允许 Java 插件在不安全模式下为单个网站或所有网站工作.在不安全模式下,小程序可以不受限制地访问本地文件系统.

此安全设置似乎是在 Java 自己的安全设置(受限/非受限访问)之上运行的.

It appears that this security setting works on top of Java's own security settings (restricted/unrestricted access).

此设置可通过 Safari 首选项/安全选项卡/Internet 插件获得:管理网站设置(然后选择 Java 插件).

This setting is available through Safari preferences / Security tab / Internet plugins: manage website settings (then select Java plugin).

因此,一旦我已经回答了我自己的原始问题,我宁愿改写它:是否可以在不要求用户设置此安全首选项的情况下为特定网站/URL 设置不安全模式或覆盖安全模式?也许像 Apple 开发者证书之类的东西会有所帮助?

So once I already answered my own original question, I would rather rephrase it: is that possible to set Unsafe mode or override Safe mode for specific web-site / URL without asking user to set this security preference? Maybe something like Apple developer certificate would help?

再次感谢!

推荐答案

我今天在使用另一个 Java 应用程序时遇到了类似的问题.我认为您可能需要将您的应用添加到此对话框中的允许下面的应用..."列表(System Prefs -> Security & Privacy -> Accessibility):

I had a similar problem with another Java app today. I think you may need to add your app to the "Allow the apps below ..." list in this dialog (System Prefs -> Security & Privacy -> Accessibility):

这篇关于Java 小程序无法在 Safari 7 (Mac OS X 10.9) 下打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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