• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in signing applet on client machine

 
ankush jain
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i am trying to sign in the applet on the client machine, i am getting the following error

java.security.AccessControlException: access denied (java.lang.RuntimePermission createSecurityManager)

My applet code is

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.security.AllPermission;

public class JVersion extends JApplet
{
public void init()
{}

public void check()
{
String versionStr = (String)System.getProperty("java.version");
if( versionStr != "1.5.0_07" )
{
System.out.println("Java Runtime Version do not match");
System.out.println("Version available : " + versionStr );
System.out.println("Version expected : 1.5.0_07");
}
else
{
try
{
SecurityManager sec = new SecurityManager();
sec.checkWrite("test.txt");
}
catch (Exception ex)
{
System.out.println("The excception is " + ex.getMessage());
ex.printStackTrace();
}
}
}
}

Can any one explain to me, what changes need to be done in java.policy file on the client machine.

And how to refresh the policy file
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

This wiki page has some information on applet signing and policy files.

As an aside, string inequality is not tested via "!=" - you should use the String.equals method.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic