applet with stream redirect

M

Mik

I'm trying to redirect stream from console to JTextArea - it works in
JBuilder but when I run applet in IE I get:
java.security.AccessControlException: access denied
(java.lang.RuntimePermission setIO)
What should I do with it?


void redirect()
{
JFrame f = new JFrame();
final JTextArea a = new JTextArea();
a.setEditable(false);
f.getContentPane().add(new JScrollPane(a));
f.setSize(600,400);
f.setLocation(10,10);
f.show();

PrintStream s = new PrintStream(new OutputStream()
{
public void write(int b) {}
public void write(byte[] b,int off, int dl)
{
a.append(new String(b,off,dl));
}
});
System.setOut(s);
System.setErr(s);
}
 
C

Chris Smith

Mik said:
I'm trying to redirect stream from console to JTextArea - it works in
JBuilder but when I run applet in IE I get:
java.security.AccessControlException: access denied
(java.lang.RuntimePermission setIO)
What should I do with it?

If you absolutely need setOut and setErr, you'll need to sign the applet
to establish your identity, and then request that permission from the
user. That's a rather involved (and expensive, when done right)
process.

Alternatively, is there any way you can obtain the information you need
without capturing the standard output and error streams?

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
M

Mik

Alternatively, is there any way you can obtain the information you need
without capturing the standard output and error streams?

There are other ways, but this one seemed to be the most easy :)
Thanks for help
 
A

Andrew Thompson

Chris Smith said:
Mik wrote: ... ...
If you absolutely need setOut and setErr, you'll need to sign the applet
to establish your identity, and then request that permission from the
user. That's a rather involved (and expensive, when done right)
process.

(raises eyebrow) 'right' Chris?
Are you saying my self-signed
certificate does it 'wrong'? ;-)

Sure, it's a pretty odious message
that comes up*, but you can get similar
messages installing drivers from major
consumer software and hardware
retailers into Windows.

And (shrugs) it works.

* http://www.physci.org/install/security.htm
 
A

Andrew Thompson

....
Really? I don't think I've seen such a message for some time, except
from applications and such inside of our corporate intranet where their
use is considered acceptable.

Well now you push me for specifics I
am pressed to recall exactly what, but
there is a piece of Sound H/W attached
to my system that brings up a dialog as
one of it's drivers is installing.

Something to the effect of 'Not approved
under MS's (stringent ..bwa ha) Compatibility
Testing - MS strongly recommends you do not
yada.. yada.."

....Perhaps I was waving my hands about
a bit vaguely, come to think of it.. ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top