I am trying to read varvible envrionment from an applet, here is my code
String env = System.getenv("TWS"); System.out.println(env); Runtime rt = Runtime.getRuntime(); String s = env + "\\WebStart.bat " ; System.out.println(s); try { Process p = rt.exec(s); } catch (Exception e) { }
when I run the code from netbeans by right-clicking and running it, it works without problems.
but when I put it in a jar file, add it to my web application and try running it from the html page using the following code
<applet code="draw.class" archive='AppletTest.jar'> <param name="shape" value="triangle"/> </applet>
I get an access denied error message , java.lang.RuntimePermission
I am running this web application using tomcat 6.
I read several tutorials and added the following entry to catalina.policy in tomcat 6 and restarted tomcat
permission java.lang.RuntimePermission "accessDeclaredMembers";
but still the same warning. can anyone suggest a solution to this problem?
- rangana
source share