Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How can I execute "ipconfig /all" from applet?

Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 (

public final static String getMacAddress() {
String macAddress ="";
Process p = Runtime.getRuntime().exec("ipconfig /all");
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:

I also have editted the java.policy in
C:\Program Files\Java\jre1.5.0_11\lib\security
C:\Program Files\Java\jdk1.5.0_11\jre\lib\security

adding the following lines :

grant codeBase ""; {
permission "<<ALL FILES>>", "read, write, delete, execute";

but I still get the error message :

access denied ( <<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
Posts: 43016
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which URL are you using to access the applet?

Is the JRE in "C:\Program Files\Java\jre1.5.0_11" the one being used by the Java Plugin?
Neir Kate
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm accessing where "" is my localhost. Oh yeah, your question make my test my code using Internet Explorer and it works, but I still get the "access denied" using mozilla firefox and when I typed in, "about lugins", it said that the Java version it is using is:
Java(TM) 2 Platform Standard Edition 5.0 U11
File name: NPJava11.dll
Java Plug-in 1.5.0_11 for Netscape Navigator (DLL Helper)

I wonder what is wrong? Is it possible that the mozilla browser using different version of jre? and is there any other way I can check this?

    Bookmark Topic Watch Topic
  • New Topic