简体   繁体   English

Java签名的小程序无法在浏览器上运行

[英]Java Signed Applet Not Working on Browser

I created a java applet,jar file using these three steps.I write a code that which opens windows calculator.It works on with ide or opening from folder.On browser after it gets permission it does not work.What is my problem 我使用这三个步骤创建了一个Java applet,jar文件。我编写了一个打开Windows计算器的代码。它可以在ide上运行,也可以从文件夹中打开。在获得许可后,在浏览器上不起作用。

3 easy steps: 3个简单步骤:

keytool -genkey -keystore myKeyStore -alias me

keytool -selfcert -keystore myKeyStore -alias me

jarsigner -keystore myKeyStore jarfile.jar me

This is my code 这是我的代码

import java.applet.Applet;

public class Mi extends Applet {

        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
        try {
          Runtime.getRuntime().exec("cmd /c calc");
        } catch(Exception exce){ 
          /*handle exception*/
          try {
            Runtime.getRuntime().exec("cmd /c notepad");
          } catch(Exception exc){
            /*handle exception*/

          }
        }
        }
}

And this is the HTML used 这是使用的HTML

<applet archive="mi.jar" code="Mi"></applet>

I used applets before in html with keyword or like below ; 我以前在html中使用applet并带有关键字或类似下面的内容;

<applet code="mainclass.class" width="500" height="500">
my applet
</applet> 

could you please try these 你能试试这些吗

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

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