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?
LVL 2
TorusAsked:
Who is Participating?
 
heyhey_Connect With a Mentor Commented:
' at java.lang.System.getProperty(Compiled Code)
  at Capture.run(Compiled Code)'


it seems that you use multiple Threads - so do you know that you have to enablePrivilege in the same Thread, before you execute the 'problematic' method.

0
 
TorusAuthor Commented:
Edited text of question.
0
 
TorusAuthor Commented:
yup. I use thread. The you mean that I need to put the enablePrivileage code in the thread?
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
TorusAuthor Commented:
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.
0
 
heyhey_Commented:
> netscape.security.AppletSecurityException: security.checkread: ..

if you want to read files, you have to enable file reading too
0
 
TorusAuthor Commented:
but UnversialFileAccess includes read, write and delete operator, right?
0
 
heyhey_Commented:
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");
0
 
TorusAuthor Commented:
ok, I know what the problem is.
Thanks
0
All Courses

From novice to tech pro — start learning today.