gpt4 book ai didi

java.lang.reflect.InitationTargetException?

转载 作者:行者123 更新时间:2023-12-01 14:40:10 25 4
gpt4 key购买 nike

我正在一个小程序中工作,当我使用 Eclipse 运行它时,我没有任何问题,但是当我尝试在 Internet Explorer 浏览器上加载该小程序时,它给出了以下错误:

java.lang.reflect.InvocationTargetException

我不知道该怎么办,为什么我的浏览器不能工作,而 Eclipse 却可以。

有什么想法吗?

我使用 appletviewer 运行它,当我按下“退出”按钮时出现问题,我必须退出游戏。它实际上并没有退出游戏...现在我更加迷失了..

-------------堆栈跟踪

C:\Course Technology\src>appletviewer TestJAlienHunt.html
Exception in thread "AWT-EventQueue-1" java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "exitVM.0")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:366)
at java.security.AccessController.checkPermission(AccessController.java:555)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.SecurityManager.checkExit(SecurityManager.java:761)
at java.lang.Runtime.exit(Runtime.java:105)
at java.lang.System.exit(System.java:960)
at JAlienHunt.actionPerformed(JAlienHunt.java:97)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6505)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
at java.awt.Component.processEvent(Component.java:6270)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4861)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)

at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:703)
at java.awt.EventQueue.access$000(EventQueue.java:102)
at java.awt.EventQueue$3.run(EventQueue.java:662)
at java.awt.EventQueue$3.run(EventQueue.java:660)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:676)
at java.awt.EventQueue$4.run(EventQueue.java:674)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:673)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre ad.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)

最佳答案

小程序不允许调用System.exit。毕竟,其他人制作的其他小程序可能正在使用该 JVM。

一般来说,当用户选择关闭或离开页面时(这会导致调用小程序的 stop 方法),小程序就会“结束”。小程序无法自行决定其操作何时结束。

理论上,您可以让您的小程序显示一个空白矩形或其他内容,但实际上,“退出”功能在小程序中根本没有意义,并且一开始就不应该存在。

关于java.lang.reflect.InitationTargetException?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16048785/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com