Permission denied when I execute a unix command from within my java applet.
843798Oct 11 2007 — edited Oct 11 2007Hi Gang,
Forgive me if this is not the appropriate forum for this problem. I'm posting this problem on this forum since I got no answers on the other forum I posted on.
I've written a simple java applet that runs a unix command and then displays some information. The applet compiles fine, and runs perfectly from the command line on my unix system.
However, when I point a browser at the applet from my desktop PC I get the following error as taken from the java console:
Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.io.FilePermission <<ALL FILES>> execute)
This is of course the first line in a long line of error messages. It appears that I am not able to execute a command on the unix system through my applet. I know the problem is with trying to execute a unix command since commenting it causes no error in the web browser. This is the command I'm using in java to execute the unix command:
p = Runtime.getRuntime().exec("ps");
Here's the html file on the unix system:
<html>
<head></head>
<body>
<appletcode=G.class height="250" width="400">
Your browser does not support the applet tag.
</applet>
</body>
</html>
I won't list the java code since it is compiling and working on the command line. But, if you want to see it I'll provide it.
I've done quite a bit of research on this and it seems that a great number of people have similar problems reading or executing files through java. I have yet to find a solution to this problem.
Here are some details about my setup:
Server:
HP9000 running HP/UX 11.23
Apache Web Server 2.0.35
Java 1.5
Desktop PC:
Win2K Pro
Internet Explorer 6
Java 1.6
If you have a solution I would be very grateful! This problem is keeping me from writing my application!
thanks!
kev