简体   繁体   English

Safari中Java Applet上格式错误的URL异常

[英]Malformed URL Exception on Java Applet in Safari

I was wondering if this is just me or what. 我想知道这只是我还是什么。 I've written an applet that works perfectly in Chrome, Firefox, and IE, but when I try it on Safari, it immediately dies on init. 我编写了一个可在Chrome,Firefox和IE上完美运行的applet,但是当我在Safari上尝试使用该applet时,它会立即在init上消失。 The thing is, my init function doesn't really do anything but print out "Initialized" to the java console. 关键是,我的init函数除了将“ Initialized”打印到Java控制台外,实际上什么也没做。

I get the following in the java console (Note my "Initialized" debugging message): 我在Java控制台中得到以下内容(请注意我的“ Initialized”调试消息):

Initialized
java.net.MalformedURLException: no protocol: 
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at sun.plugin.liveconnect.SecureInvocation.checkLiveConnectCaller(Unknown Source)
    at sun.plugin.liveconnect.SecureInvocation.access$000(Unknown Source)
    at sun.plugin.liveconnect.SecureInvocation$2.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.plugin.liveconnect.SecureInvocation.CallMethod(Unknown Source)

I'm starting to think it's a Safari problem since the act of trying to start an applet makes it fail. 我开始认为这是Safari问题,因为尝试启动小程序的行为会使它失败。

Looks like WebKit is removing the http:// 看起来WebKit正在删除http://

Btw, it is not in your init function, it is URL's constructor 顺便说一句,它不在您的init函数中,它是URL的构造函数

Apparently, Safari doesn't like that the method I was calling in the applet was called "print" 显然,Safari不喜欢我在applet中调用的方法称为“打印”

I renamed it to "printDocument" and it works now. 我将其重命名为“ printDocument”,并且现在可以使用。 I still get that malformed url exception, but it doesn't seem to prevent the applet from working at all. 我仍然收到格式错误的url异常,但这似乎并没有阻止applet完全正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM