Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Has anyone created a Applet that wo

Status
Not open for further replies.

BZJavaInst

Programmer
Jan 17, 2001
67
US
Has anyone created a Applet that would allow Java code to execute around the Sand Box security? Here is an example I found, but I do not know where to find the Microsoft or Netscape packages to do this? Has anyone worked with something like this? My users are running on a Intranet and we would like to get the system properties of the machine they are running the applet on. For ex. the computer user name.

CODE:

/* class SignedParm2 displays in textarea the system parameters.
designed to run as signed applet in both Communicator 4+ and IE4+
web browsers. Since the applet runs it's privileged method in
the init() method, IE code must explicitly assert permissions here.
M. Gallant 11/04/1999
*/

import com.ms.security.*; //* microsoft package
import java.awt.*;
import java.applet.*;
import java.io.* ;
import java.util.*;
import netscape.security.PrivilegeManager; //* netscape pk

public class SignedParm2 extends Applet {
FontMetrics fm;
int xtab, ystep ;
String nl ; // new line character
String[] graphString = new String[20] ;
int strings = 0;
TextArea ta = new TextArea (25, 80);
public void init() {

try {
if (Class.forName("com.ms.security.PolicyEngine") != null) { // required for IE
PolicyEngine.assertPermission(PermissionID.PROPERTY);
}
}
catch (Throwable cnfe) {
}
this.setBackground(new Color(192,192,192)) ;
add(ta) ;

try{
PrivilegeManager.enablePrivilege("UniversalPropertyWrite") ; // required for NN
}
catch(Exception cnfe) {
System.out.println("netscape.security.PrivilegeManager class not found") ;
}

Properties sysprops = System.getProperties() ;
Enumeration enprop = sysprops.propertyNames() ;
String str = "" ;
ta.setText("") ;
while ( enprop.hasMoreElements() ) {
String key = (String) enprop.nextElement() ;
// System.out.println(key+"\t"+sysprops.getProperty(key));
str = key+"\t"+sysprops.getProperty(key) ;
ta.append(str + "\n");
}
// PrivilegeManager.disablePrivilege("UniversalPropertyWrite") ;
}

}

Can anyone help? I would really appreciate it.
Thanks, Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top