aspose file tools
The moose likes Java in General and the fly likes access denied Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark " access denied " Watch " access denied " New topic
Author access denied

Harsha Ravnikar

Joined: Feb 23, 2000
Posts: 7

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

public void init()
///////////////// Redefine line seperator here ///////////////////
Properties sysProp = System.getProperties();
String lineprop = sysProp.getProperty("line.separator");
///////////////// 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);
resize(350, 300);
AppletViewer displays this message ....
******************************* access denied (java.util.PropertyPermission * read,write)
at, Compiled Code)
at, Compiled Code)
at java.lang.SecurityManager.checkPermission(, Compiled Code)
at java.lang.SecurityManager.checkPropertiesAccess(
at java.lang.System.getProperties(
at kannada_av.init(
Carl Trusiak

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

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

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

Joined: Feb 26, 2001
Posts: 5484

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

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

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:
subject: access denied