Date: Fri, 29 Aug 1997 13:15:41 -0700
From: shih@young.epc.lmms.lmco.com (John Shih J15337 TCCS)
Message-Id: <199708292015.NAA01275@california.coe49er>
To: java-security@web2.javasoft.com
Subject: Security Exception to run Java applet by using Netscape
Dear Sir,
I wrote a Java applet code to invoke a C++ standalone on Sun Solaris.
I can run it fine using Hotjava or Appletviewer. When I use Netscape
to read it, I receive the following error.
Run test program
java.lang.SecurityException: exec is not allowed
at java.lang.Runtime.exec(Runtime.java:98)
at java.lang.Runtime.exec(Runtime.java:71)
at MyFirstApplet.paint(MyFirstApplet.java:16)
at sun.awt.motif.MComponentPeer.paint(MComponentPeer.java:125)
at sun.awt.motif.MComponentPeer.handleExpose(MComponentPeer.java:264)
at java.lang.Thread.run(Thread.java:296)
My Java code is listed as following.
import java.lang.*;
import java.io.*;
import java.applet.Applet;
import java.awt.Graphics;
public class MyFirstApplet extends Applet {
public void paint(Graphics g) {
g.drawString("Run test C++ program", 20, 20);
try
{
System.out.println("Run test program");
g.drawString("Start test_c executable", 20, 400);
Runtime.getRuntime().exec("test_c");
g.drawString("End of test_c executable", 20, 90);
}
catch(IOException e)
{
System.out.println("exception: " + e.getMessage());
e.printStackTrace();
}
}
}
--------------------------------------------------
My HTML is listed as following.
Would you please let me know how to solve the problem.
Thanks
John Shih