*
The moose likes Java in General and the fly likes java.security.AccessControlException: access denied Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java.security.AccessControlException: access denied " Watch "java.security.AccessControlException: access denied " New topic
Author

java.security.AccessControlException: access denied

Harsha Ravnikar
Greenhorn

Joined: Feb 23, 2000
Posts: 7

Hi,
I get a security exception when I redefine line seperator. Can any body help me out? I'll be greatful.
Regards,
Harsha

public void init()
{
///////////////// Redefine line seperator here ///////////////////
Properties sysProp = System.getProperties();
String lineprop = sysProp.getProperty("line.separator");
sysProp.put("line.separator","\n");
System.setProperties(sysProp);
///////////////// End redefining line seperator //////////////////
setLayout(new BorderLayout());
text = new TextArea(7,35);
add("North", text);
add("South", new Label("To be run on Netscape 4.7"));
Font newFont = new Font("serif",Font.PLAIN,26);
text.setFont(newFont);
resize(350, 300);
text.requestFocus();
}
AppletViewer displays this message ....
*******************************
java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java, Compiled Code)
at java.security.AccessController.checkPermission(AccessController.java, Compiled Code)
at java.lang.SecurityManager.checkPermission(SecurityManager.java, Compiled Code)
at java.lang.SecurityManager.checkPropertiesAccess(SecurityManager.java:1215)
at java.lang.System.getProperties(System.java:484)
at kannada_av.init(kannada_av.java:65)
at sun.applet.AppletPanel.run(AppletPanel.java:333)
at java.lang.Thread.run(Thread.java:479)
*******************************
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
You are trying to set a System configuration parameter from an Applet. There is a security manager to prevent Applets from changing System parameters, This is to provide you security from rouge Applets on the web. If you ran this as an application without a security manager, it compiles and runs fine.


I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
John Wayne
Greenhorn

Joined: Jun 06, 2001
Posts: 1
Nice explanation Carl, but how about helping him out a little bit with how he might get it to work instead of a winded reason of why it doesn't. This isn't a forum to share your extent of Java knowledge as to why something doesn't work but rather a place for like minded and helpful Java developers to assist and be assisted in their various Java excursions.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Ummm... Carl did provide a possible solution. It may or may not be satisfactory in this case, depending on just what Harsha is trying to do. Does the program have to be an Applet? If so, I don't know any way to redefine the line separator. (Personally, I almost never use Applets.) Maybe it's possible to reset the security permissions for what Applets are allowed to do - but I'm sure that can't be done by the Applet itself, so this may also be unworkable for Harsha. The question then becomes - why does that line separator need to be redefined, and how is it being used - there may be a way to work around that. One way is to never use println() or similar methods which rely on the system line separator - instead write the separator you want yourself. E.g.
<code><pre> System.out.print("Hi!\n");</pre></code>
rather than
<code><pre> System.out.println("Hi!");</pre></code>
"John", you should realize that none of us has an infinite amount of time, and we don't know everything. If we have some information which can help someone, and we have time to share it, we do so. We aren't under any obligation to provide a complete solution if we don't know one or don't have time for it. The benefit of having a large number of posters is that chances are, if a solution exists, someone else can build on what you post and eventually you may reach the desired solution. That's assuming that the other posters aren't put off by whiny, ungrateful people who are miffed that they didn't get the answer they wanted right away.
[This message has been edited by Jim Yingst (edited June 06, 2001).]


"I'm not back." - Bill Harding, Twister
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4442
    
    5

Did the Duke get reincarnated as a troll?
killList.add("John Wayne");

Junilu - [How to Ask Questions] [How to Answer Questions]
Harsha Ravnikar
Greenhorn

Joined: Feb 23, 2000
Posts: 7
Hi Guys,
I never got any reply to that post. Then on, dint really hang around this place for long. Good we get an email notification whenever a post is answered. Nice feature.
At that time, I was manipulating text as and when it was being entered. But there is a bug in java.awt.TextArea in JVM 1.1.5 by which we get incorrect caret position problem. And I was in the process of figuring it out. BUt now I have a beautiful fix for that which I always use as an replacement for java.awt.TextArea when ever Java Plugin is not an option
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.security.AccessControlException: access denied
 
Similar Threads
java.security.AccessControlException
AccessControlException
java.security.AccessControlException: access denied
Error When Writing Text to Unix File
EJB - Blazix server....problem with privileges