在运行hello world小程序时,我得到了不兼容的魔术值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>发布于 2012-02-14 18:52:19
这个问题与您在<applet ...>元素中指定存档的方式有关。
看看元素在到达web浏览器时到底是什么样子。提示:使用"View as source“。
我预计发生的情况是存档的URL不正确,并导致服务器发送错误页面。浏览器试图解释错误页面的HTML内容,就好像它是一个JAR文件或一个类文件,并发现它没有所需的“魔术数字”。
(尝试查看十六进制数字,然后将字节映射到ASCII...)
https://stackoverflow.com/questions/9275395
复制相似问题