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

Discussion in 'Java' started by Z, Feb 20, 2007.

  1. Z

    Z Guest

    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.
    Z, Feb 20, 2007
    #1
    1. Advertising

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

    On Feb 21, 4:46 am, Z <> 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.
    Andrew Thompson, Feb 20, 2007
    #2
    1. Advertising

  3. Z

    mickey Guest

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

    On Feb 20, 10:46 pm, Z <> 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
    mickey, Feb 20, 2007
    #3
  4. Z

    Z Guest

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

    Andrew Thompson wrote:
    > On Feb 21, 4:46 am, Z <> 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.
    Z, Feb 20, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Thanasis \(sch\)
    Replies:
    0
    Views:
    5,477
    Thanasis \(sch\)
    Mar 1, 2004
  2. BADBOY
    Replies:
    8
    Views:
    6,680
    Roedy Green
    Jul 12, 2004
  3. Replies:
    1
    Views:
    836
    Matt Humphrey
    Aug 14, 2006
  4. nandu
    Replies:
    3
    Views:
    647
    nandu
    Dec 18, 2006
  5. Qu0ll
    Replies:
    17
    Views:
    2,101
    Andrew Thompson
    Jun 29, 2008
Loading...

Share This Page