Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Instantiating a JFrame in a JApplet (exception java.security.AccessControlException)

Reply
Thread Tools

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

 
 
Z
Guest
Posts: n/a
 
      02-20-2007
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.

 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      02-20-2007
On Feb 21, 4:46 am, Z <(E-Mail Removed)> wrote:
> 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.

 
Reply With Quote
 
 
 
 
mickey
Guest
Posts: n/a
 
      02-20-2007
On Feb 20, 10:46 pm, Z <(E-Mail Removed)> wrote:
> 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

 
Reply With Quote
 
Z
Guest
Posts: n/a
 
      02-20-2007
Andrew Thompson wrote:
> On Feb 21, 4:46 am, Z <(E-Mail Removed)> wrote:
>> 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.)


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

Thank you. I would have never found that.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How Can I Get One JFrame To Appear Above Another JFrame clusardi2k@aol.com Java 2 08-27-2012 03:01 PM
Animated GIF display in JFrame vs. JApplet Qu0ll Java 17 06-29-2008 07:03 AM
start a new JFrame from an existing one, and when old JFrame closes new one does not jakester Java 3 04-02-2007 11:13 PM
Re: JApplet + API question Eric Olander Java 1 07-08-2003 04:03 PM
Re: JApplet + API question John C. Bollinger Java 0 06-27-2003 05:13 PM



Advertisments