1

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

3 easy steps:

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

<applet archive="mi.jar" code="Mi"></applet>
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • 1) `/*handle exception*/` For better help sooner, post an [SSCCE](http://sscce.org/). 2) Why use a `Process` instead of `java.awt.Desktop`? 3) That is a very shoddy implementation of running a process, I'd be more surprised if it worked, than failed. 4) Were you [prompted to trust](http://stackoverflow.com/q/12986333/418556) the new code? – Andrew Thompson Apr 10 '13 at 00:04
  • If it is a problem for any general applet that you create, then you could try this: http://stackoverflow.com/questions/13482331/browser-doesnt-show-java-applet/13487833#13487833 – jatin3893 Apr 10 '13 at 18:15

1 Answers1

1

I used applets before in html with keyword or like below ;

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

could you please try these

daemonThread
  • 243
  • 2
  • 12