Java Plug-in 1.5.0_12
使用 JRE 版本 1.5.0_12 Java HotSpot(TM) Client VM
用户主目录 = C:\Documents and Settings\microsoft
----------------------------------------------------
c: 清除控制台窗口
f: 终结在结束队列上的对象
g: 垃圾收集
h: 显示此帮助消息
l: 转储类载入程序列表
m: 打印内存使用
o: 触发日志记录
p: 重新载入代理配置
q: 隐藏控制台
r: 重新载入策略配置
s: 转储系统和部署属性
t: 转储线程列表
v: 转储线程堆栈
x: 清除类载入程序高速缓存
0-5: 设置跟踪级别为<n>
----------------------------------------------------
java.lang.NoClassDefFoundError: Display_Image (wrong name: xstp/Display_Image)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
请问高人怎么解决呀?
1 个解决方案
#1
我也遇到了类似的问题,在eclipse中运行applet小程序时一切正常,但在IE中总是无法加载
貌似eclipse运行的时候会自动生成一个java.policy.applet文件,修改java的安全机制来运行applet
我也想请教一下高人自己如何更改java的安全机制来运行applet。
已在user.home目录下建立了一个.java.plicy文件,其内容为
grant codeBase
"file:F:/Study/Java/Introduction_to_Java_Programming/bin/Chapter_14_Examples.Test.class" {
permission java.security.AllPermission;
};
Test是我的测试程序,代码如下
package _Chapter_14_Examples;
import javax.swing.*;
public class Test extends JApplet {
public Test() {
//String sourcePath = _Resource.Resource.getResourcePath(14);
//System.out.println(sourcePath);
ImageViewer viewer = new ImageViewer(
new ImageIcon("F:/Study/Java/Introduction_to_Java_Programming/resource/chapter_14/1.JPG").getImage());
getContentPane().add(viewer);
}
}
在eclipse中可以正常运行,但在ie中却会抛出错误
java.security.AccessControlException: access denied (java.io.FilePermission F:\Study\Java\Introduction_to_Java_Programming\resource\chapter_14\1.JPG 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 sun.awt.SunToolkit.getImageFromHash(Unknown Source)
at sun.awt.SunToolkit.getImage(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at _Chapter_14_Examples.Test.<init>(Test.java:24)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.security.AccessControlException: access denied (java.io.FilePermission F:\Study\Java\Introduction_to_Java_Programming\resource\chapter_14\1.JPG 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 sun.awt.SunToolkit.getImageFromHash(Unknown Source)
at sun.awt.SunToolkit.getImage(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at _Chapter_14_Examples.Test.<init>(Test.java:24)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
希望高人也能帮忙看看
貌似eclipse运行的时候会自动生成一个java.policy.applet文件,修改java的安全机制来运行applet
我也想请教一下高人自己如何更改java的安全机制来运行applet。
已在user.home目录下建立了一个.java.plicy文件,其内容为
grant codeBase
"file:F:/Study/Java/Introduction_to_Java_Programming/bin/Chapter_14_Examples.Test.class" {
permission java.security.AllPermission;
};
Test是我的测试程序,代码如下
package _Chapter_14_Examples;
import javax.swing.*;
public class Test extends JApplet {
public Test() {
//String sourcePath = _Resource.Resource.getResourcePath(14);
//System.out.println(sourcePath);
ImageViewer viewer = new ImageViewer(
new ImageIcon("F:/Study/Java/Introduction_to_Java_Programming/resource/chapter_14/1.JPG").getImage());
getContentPane().add(viewer);
}
}
在eclipse中可以正常运行,但在ie中却会抛出错误
java.security.AccessControlException: access denied (java.io.FilePermission F:\Study\Java\Introduction_to_Java_Programming\resource\chapter_14\1.JPG 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 sun.awt.SunToolkit.getImageFromHash(Unknown Source)
at sun.awt.SunToolkit.getImage(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at _Chapter_14_Examples.Test.<init>(Test.java:24)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.security.AccessControlException: access denied (java.io.FilePermission F:\Study\Java\Introduction_to_Java_Programming\resource\chapter_14\1.JPG 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 sun.awt.SunToolkit.getImageFromHash(Unknown Source)
at sun.awt.SunToolkit.getImage(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at _Chapter_14_Examples.Test.<init>(Test.java:24)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
希望高人也能帮忙看看
#1
我也遇到了类似的问题,在eclipse中运行applet小程序时一切正常,但在IE中总是无法加载
貌似eclipse运行的时候会自动生成一个java.policy.applet文件,修改java的安全机制来运行applet
我也想请教一下高人自己如何更改java的安全机制来运行applet。
已在user.home目录下建立了一个.java.plicy文件,其内容为
grant codeBase
"file:F:/Study/Java/Introduction_to_Java_Programming/bin/Chapter_14_Examples.Test.class" {
permission java.security.AllPermission;
};
Test是我的测试程序,代码如下
package _Chapter_14_Examples;
import javax.swing.*;
public class Test extends JApplet {
public Test() {
//String sourcePath = _Resource.Resource.getResourcePath(14);
//System.out.println(sourcePath);
ImageViewer viewer = new ImageViewer(
new ImageIcon("F:/Study/Java/Introduction_to_Java_Programming/resource/chapter_14/1.JPG").getImage());
getContentPane().add(viewer);
}
}
在eclipse中可以正常运行,但在ie中却会抛出错误
java.security.AccessControlException: access denied (java.io.FilePermission F:\Study\Java\Introduction_to_Java_Programming\resource\chapter_14\1.JPG 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 sun.awt.SunToolkit.getImageFromHash(Unknown Source)
at sun.awt.SunToolkit.getImage(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at _Chapter_14_Examples.Test.<init>(Test.java:24)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.security.AccessControlException: access denied (java.io.FilePermission F:\Study\Java\Introduction_to_Java_Programming\resource\chapter_14\1.JPG 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 sun.awt.SunToolkit.getImageFromHash(Unknown Source)
at sun.awt.SunToolkit.getImage(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at _Chapter_14_Examples.Test.<init>(Test.java:24)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
希望高人也能帮忙看看
貌似eclipse运行的时候会自动生成一个java.policy.applet文件,修改java的安全机制来运行applet
我也想请教一下高人自己如何更改java的安全机制来运行applet。
已在user.home目录下建立了一个.java.plicy文件,其内容为
grant codeBase
"file:F:/Study/Java/Introduction_to_Java_Programming/bin/Chapter_14_Examples.Test.class" {
permission java.security.AllPermission;
};
Test是我的测试程序,代码如下
package _Chapter_14_Examples;
import javax.swing.*;
public class Test extends JApplet {
public Test() {
//String sourcePath = _Resource.Resource.getResourcePath(14);
//System.out.println(sourcePath);
ImageViewer viewer = new ImageViewer(
new ImageIcon("F:/Study/Java/Introduction_to_Java_Programming/resource/chapter_14/1.JPG").getImage());
getContentPane().add(viewer);
}
}
在eclipse中可以正常运行,但在ie中却会抛出错误
java.security.AccessControlException: access denied (java.io.FilePermission F:\Study\Java\Introduction_to_Java_Programming\resource\chapter_14\1.JPG 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 sun.awt.SunToolkit.getImageFromHash(Unknown Source)
at sun.awt.SunToolkit.getImage(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at _Chapter_14_Examples.Test.<init>(Test.java:24)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.security.AccessControlException: access denied (java.io.FilePermission F:\Study\Java\Introduction_to_Java_Programming\resource\chapter_14\1.JPG 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 sun.awt.SunToolkit.getImageFromHash(Unknown Source)
at sun.awt.SunToolkit.getImage(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at _Chapter_14_Examples.Test.<init>(Test.java:24)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
希望高人也能帮忙看看