Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Runtime Exec Applet runs with Appletviewer but not with IE or Netscape

843798Jul 11 2001 — edited Jul 12 2001
I have created an applet that open the notepad when a button is clicked. (It is the previous applet that will open a software design application that we want to control and administrate over our corporate network). This is the code:

import java.awt.*;
import java.applet.Applet;
import java.io.*;

public class botex extends Applet {
Button b1;

public void init() {
b1 = new Button( "Boton B1" );

this.add( b1 );
}

public boolean action( Event evt,Object obj ) {
if( evt.target.equals( b1 ) )
try{
Runtime.getRuntime().exec("notepad.exe");

} catch (IOException exception) {
System.out.println ( "we cant open notepad");
}

return true;
}
}

I have compiled it with JDK 1.1.4 java compiler.
Then I have embedded the botex.class file into the botex.htm with the following sintax:

<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<APPLET CODE="botex.class" WIDTH="150" HEIGHT="100"></APPLET>
</BODY>
</HTML>

So when the applet is run from the DOS command line :

c:> appletviewer botex.htm

The applet is started and when you click the button it opens the notepad.

BUT WHEN YOU OPEN THE botex.htm with any of the famous browsers IE (5.50) or Netscape (4.75) you can see the button, but when you click, nothing happens, not even the catch exception message appear.

Anyone can tell me how to make this applet work with the browser???

I really appreciate your help
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 9 2001
Added on Jul 11 2001
3 comments
104 views