![](/img/trans.png)
[英]java applet fail when launched with server “incompatible magic value 1013478509”
[英]Incompatible magic value 1013084704 when running java applet
运行hello world applet时出现不兼容的魔术值1013084704错误:
import javax.swing.JApplet;
import javax.swing.SwingUtilities;
import javax.swing.JLabel;
public class Screenshot extends JApplet {
//Called when this applet is loaded into the browser.
public void init() {
//Execute a job on the event-dispatching thread; creating this applet's GUI.
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JLabel lbl = new JLabel("Hello World");
add(lbl);
}
});
} catch (Exception e) {
System.err.println("createGUI didn't complete successfully");
}
}
}
HTML代码:
<applet code="Screenshot.class" archive="<?php echo URLgenerator::getScryptURL('screenshot.jar')?>" width="100px" height="100px"></applet>
问题与您在<applet ...>
元素中指定档案的方式有关。
看一下元素到达Web浏览器时的外观。 提示:使用“查看为源”。
我希望所发生的情况是存档的URL不正确,并导致服务器传递错误页面。 浏览器试图将错误页面的HTML内容解释为是JAR文件还是类文件,并发现该页面没有所需的“幻数”。
(尝试以十六进制查看该数字,然后将字节映射到ASCII ...)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.