Tag: accesscontrolexception

在浏览器中调试java applet – 在Eclipse中工作但不在浏览器中工作

我创建了一个applet,它打开一个JFileChooser来选择一个JButton点击的文件。 当我在Eclipse中运行它时它工作正常。 当我将它嵌入带有applet标签的HTML页面时,单击按钮时没有任何反应。 关于为什么JFileChooser不能在浏览器中打开的任何建议都会受到赞赏, 但我的主要问题是如何调试这个? 我无法在Google上找到有关如何将Java控制台添加到Firefox 3.6或Chrome的任何内容。 有没有办法获得有关JFileChooser无法打开的原因的某种信息? 调试在下面的评论中回答 所以控制台说有一个访问被拒绝的exception,我猜是因为我没有“签名”applet。 在签署applet时,开发过程应该是什么? 在我可以在浏览器中测试之前,是否必须使用由有效CA颁发的证书对其进行签名,或者在测试时是否可以执行一些简单的操作? 这是我的代码: package com.putapplet; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.File; import java.io.InputStreamReader; import java.net.URL; import javax.swing.JApplet; import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.SwingUtilities; @SuppressWarnings(“serial”) public class PutToS3Applet extends JApplet { private static long […]

读取Elasticsearch插件中的文件

我正在编写一个elasticsearch插件,它依赖于从磁盘上的文件中读取数据。 当我尝试在我的代码中访问此文件时,我得到以下exception。 Caused by: java.security.AccessControlException: access denied (“java.io.FilePermission” “patient_similarity/codes.txt” “read”) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) at java.security.AccessController.checkPermission(AccessController.java:884) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at java.lang.SecurityManager.checkRead(SecurityManager.java:888) at java.io.FileInputStream.(FileInputStream.java:127) at org.gatech.lucene.search.store.DotProductStore.(DotProductStore.java:22) at org.gatech.lucene.search.store.DotProductStore.newInstance(DotProductStore.java:71) at org.gatech.elasticsearch.CommonsPlugin.onModule(CommonsPlugin.java:39) 有没有推荐的方法来访问elasticsearch插件中的文件? 有没有快速的解决方法来访问我的插件中的文件?

签名的applet在从javascript调用时给出AccessControlException:访问被拒绝

我有一个简单的自签名小程序(用keytool和jarsigner完成): public class NetAppletLauncher extends JApplet { private static final long serialVersionUID = 1L; public void init() { exec(“notepad c:/hello.txt”); } public void exec(String command) { try { // launch EXE and grab stdin/stdout and stderr Process process = Runtime.getRuntime().exec(command); // OutputStream stdin = process.getOutputStream(); InputStream stderr = process.getErrorStream(); InputStream stdout = process.getInputStream(); // “write” […]

java.security.AccessControlException:拒绝访问(java.io.FilePermission

final File parentDir = new File(“S:\\PDSPopulatingProgram”); parentDir.mkdir(); final String hash = “popupateData”; final String fileName = hash + “.txt”; final File file = new File(parentDir, fileName); file.createNewFile(); // Creates file PDSPopulatingProgram/popupateData.txt 我正在尝试在文件夹中创建一个文件,但我得到例外 java.security.AccessControlException: Access denied 我在Windows环境中工作。 我可以从Windows资源管理器创建一个文件夹,但不能从Java代码创建。 我该如何解决这个问题?

Java RMI AccessControlException:访问被拒绝

嘿我得到一个AccessControlException: access denied尝试启动我正在编写的RMI应用程序时AccessControlException: access denied ,如果我在默认端口1099或其他动态端口上打开它,我无法理解为什么会出现此exception我的政策文件目前授予所有内容(将在应用完成后更改)。 我被困在哪里出错了,任何帮助都会很有用 我的代码 public class Main { /** * @param args the command line arguments */ public static void main(String[] args) throws RemoteException, AlreadyBoundException, MalformedURLException { if (System.getSecurityManager() == null) { System.setSecurityManager ( new RMISecurityManager() ); } CreditCardServer ccs = new CreditCardServer(); int port = 1099; try { port = […]