Instantiating a JFrame in a JApplet (exception java.security.AccessControlException)

Z

Z

I've created a JFrame (name: SalesEntryForm) in my visual designer
(NetBeans).

When I try to instantiate that JFrame within my JApplet's start() or
init() method:
SalesEntryForm entryForm = new SalesEntryForm();


I get this error:
exception: java.security.AccessControlException: access denied
(java.lang.RuntimePermission exit VM.0)


Oddly, I can instantiate a simple JFrame without error:
JFrame entryForm = new JFrame();


What's going on?! What am I doing wrong?

How do I remedy this error?

Also, what's the most efficient way to debug a JApplet? I'm resorting to
trial and error because I haven't found a way to run a JApplet in the
IDE debugger.
 
A

Andrew Thompson

I've created a JFrame (name: SalesEntryForm) in my visual designer
(NetBeans).

When I try to instantiate that JFrame within my JApplet's start() or
init() method:
SalesEntryForm entryForm = new SalesEntryForm();

I get this error:
exception: java.security.AccessControlException: access denied
(java.lang.RuntimePermission exit VM.0)

An applet is not allowed to cause the VM
to exit. Since you 'control' the code,
you might change the exit behaviour of the
JFrame to not attempt to end the VM on close.
(There are other more kludgy alternatives,
if you do not control the code.)

Andrew T.
 
M

mickey

I've created a JFrame (name: SalesEntryForm) in my visual designer
(NetBeans).

When I try to instantiate that JFrame within my JApplet's start() or
init() method:
SalesEntryForm entryForm = new SalesEntryForm();

I get this error:
exception: java.security.AccessControlException: access denied
(java.lang.RuntimePermission exit VM.0)

Oddly, I can instantiate a simple JFrame without error:
JFrame entryForm = new JFrame();

What's going on?! What am I doing wrong?

How do I remedy this error?

Also, what's the most efficient way to debug a JApplet? I'm resorting to
trial and error because I haven't found a way to run a JApplet in the
IDE debugger.

hi...
first of all before resolving this problem ..the thing id which layout
r u using ....or "Set Bounds"???

TRY TO USE CONTENT PANE ..
in CONTENT PANE FIT YOUR COMPONENTS

i may b wrong ..plz refer Sun Java Tutorial or download it from sun's
site..
ok
 
Z

Z

Andrew said:
An applet is not allowed to cause the VM
to exit. Since you 'control' the code,
you might change the exit behaviour of the
JFrame to not attempt to end the VM on close.
(There are other more kludgy alternatives,
if you do not control the code.)

That was it. I just had to change the defaultCloseOperation.

Thank you. I would have never found that.
 

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,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top