我想在html代码中打开我的Applet.jar。加载一个JFrame到html
我的Java代码是:
public class NewJFrame extends javax.swing.JFrame {
public NewJFrame() {
initComponents();
}
private void initComponents() {
setTitle("Example");
//more lines code base in JFrame with button,labels etc
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NewJFrame().setVisible(true);
}
});
}
}
我的HTML代码是:
<!DOCTYPE html>
<html>
<body>
<h1>Java Applet Example</h1>
<p><object type="application/x-java-applet" width="300" height="300"> <param name="code" value="NewJFrame.class" /> <param name="archive" value="20130717_Applet.jar" /> <param name="mayscript" value="true" /> Java failed to load </object></p>
</body>
</html>
所以,当我试图打开HTML文件用一个浏览器,它抛出了我:
Java错误:“ClassNotFoundException NewJFrame.class”
我更改了java co的安全性控制面板从中等到高,但我得到相同的错误。
尝试更改为低。这里不是专家,但我想档案需要数字签名。我可能是错的:) –
没有“低”选项最低为中 – NickName
http://stackoverflow.com/questions/16196425/java-error-your-security-settings-have-blocked-a-local-application -from-runnin –