Java - 如何在Java Web Start中获得权限 [英] Java - How to get permission in Java Web Start
问题描述
您成功为我的Java应用程序创建了jar和.jnlp文件,但在运行时遇到了麻烦。使用Java Web Start启动好但我认为我需要做一些额外的事情,因为当我运行它时,它不会要求获得访问文件I / O的HD的许可。
Hi managed to create the jar and .jnlp files for my Java application but running into trouble when it runs. Launches okay with Java Web Start but I think I need to do something extra as normally when I run it it doesn't ask for permission to access the HD for file I/O.
希望获得一些帮助,并建议知道如何获得许可权,即我必须做的是我必须要对所有课程做些什么不确定。我在Java Web Start中收到的错误
消息如下所示。
Would appreciate some help and advise to know what to do to get the permission rights i.e. what do I have to do is it something I have to do to all my classes not sure. The error message I get in Java Web Start is as below.
Exception in thread "AWT-EventQueue-0" java.security.AccessControlException:
access denied (java.io.FilePermission StockDatabase;Stocks.dat read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkRead(Unknown Source)
at java.io.File.exists(Unknown Source)
at StockCodeDatabase.<init>(OptraderSA.java:782)
at OptraderSA.actionPerformed(OptraderSA.java:136)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unkno
推荐答案
你需要签署您的JNLP文件并配置< security>
元素,如上所述这里。
You need to sign your JNLP file and configure the <security>
element, as discussed here.
这篇关于Java - 如何在Java Web Start中获得权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!