Link to home
Start Free TrialLog in
Avatar of Torus
Torus

asked on

applets grants permission in Netscape

I wrote a applet and want to grant permission to read property.
I add the following code.
netscape.security.PrivilegeManager.enablePrivilege("UniversalProperty read);

Then I use System.getProperty("user.home").
When I run the applet, I see a dialog box asking me to grant or deny permission.( Because I haven't signed my applet, it said my is not digitally signed). Then I pressed grant button.
But when running the getProperty statement. The following error
occurs

# Applet exception: security.checkpropsaccess.key

netscape.security.AppletSecurityException: security.checkpropsaccess.key

  at java.lang.Throwable.<init>(Compiled Code)

  at java.lang.Exception.<init>(Compiled Code)

  at java.lang.RuntimeException.<init>(Compiled Code)

  at java.lang.SecurityException.<init>(Compiled Code)

  at netscape.security.AppletSecurityException.<init>(Compiled Code)

  at netscape.security.AppletSecurityException.<init>(Compiled Code)

  at netscape.security.AppletSecurity.checkPropertyAccess(Compiled Code)

  at java.lang.SecurityManager.checkPropertyAccess(Compiled Code)

* at java.lang.System.getProperty(Compiled Code)

  at Capture.run(Compiled Code)

  at java.lang.Thread.run(Compiled Code)

java.io.IOException: CreateProcess: vcafe -netscape error=2

  at java.lang.Win32Process.<init>(Compiled Code)

  at java.lang.Runtime.exec(Compiled Code)

* at java.lang.Runtime.exec(Compiled Code)

  at netscape.debug.Debugger.launchDebugger(Compiled Code)

  at netscape.debug.Debugger.uncaughtException(Compiled Code)

  at netscape.applet.AppletThreadGroup.uncaughtException(Compiled Code)


What's the problem?

ALso, netscape's JVM has java.security package?
Avatar of Torus
Torus

ASKER

Edited text of question.
ASKER CERTIFIED SOLUTION
Avatar of heyhey_
heyhey_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Torus

ASKER

yup. I use thread. The you mean that I need to put the enablePrivileage code in the thread?
Avatar of Torus

ASKER

I tried to put enablePrivilege("UniversalFileAccess") to the thread also. But I got error when reading file

netscape.security.AppletSecurityException: security.checkread: Codebase 'MyDir' does not include 'UserhomeDir/user.wav'

MyDir is the directory storing the class file. I tested it in local machine only without using web server.

It seems I can't read the UserhomeDir file.
> netscape.security.AppletSecurityException: security.checkread: ..

if you want to read files, you have to enable file reading too
Avatar of Torus

ASKER

but UnversialFileAccess includes read, write and delete operator, right?
can't check at the moment ...
I found these three lines of code in some old project
      netscape.security.PrivilegeManager.enablePrivilege("UniversalFileRead");
      netscape.security.PrivilegeManager.enablePrivilege("UniversalFileWrite");
      netscape.security.PrivilegeManager.enablePrivilege("UniversalConnect");
Avatar of Torus

ASKER

ok, I know what the problem is.
Thanks