Hi all,
I'm still new in java applet, so there are some problems that I cannot solve, and I need help from the masters here
I'm trying to execute "ipconfig /all" (In Windows of course) using the Java code, as follow (InetAddressApplet.java):
public final static String getMacAddress() {
String macAddress ="";
bla...bla...
Process p = Runtime.getRuntime().exec("ipconfig /all");
bla...bla..bla
return macAddress;
}
and in the jsp, I have also include the applet:
<applet code="InetAddressApplet.class" width="0" height="0" name="InetAddressApplet"></applet>
then, I'm trying to get the MacAddress by parsing the value I get from "ipconfig /all" by using:
alert(document.applets['InetAddressApplet'].getMacAddress());
I also have editted the java.policy in
C:\Program Files\Java\jre1.5.0_11\lib\security
and
C:\Program Files\Java\jdk1.5.0_11\jre\lib\security
adding the following lines :
grant codeBase "http://192.168.1.46:7080/emf/-" {
permission java.security.AllPermission;
permission java.io.FilePermission "<<ALL FILES>>", "read, write, delete, execute";
};
but I still get the error message :
access denied (java.io.FilePermission <<ALL FILES>> execute)
after I print the trace, it stated that the access is denied in the line that's calling "ipconfig /all", how can I solve this problem? Are there any steps that I missed?
Thanks in advance, and sorry for my poor english