InstantiationException running an applet

Discussion in 'Java' started by giangiammy@yahoo.com, Jul 11, 2005.

  1. Guest

    hi all,

    I wrote a small java application to implement a telnet client.
    I run it correctly as a Java application, but if I try to
    run it as an applet I get the following:

    load: Jmanager.class can't be instantiated.
    java.lang.InstantiationException: Jmanager
    at java.lang.Class.newInstance0(Class.java:293)
    at java.lang.Class.newInstance(Class.java:261)
    at sun.applet.AppletPanel.createApplet(AppletPanel.java:617)
    at sun.applet.AppletPanel.runLoader(AppletPanel.java:546)
    at sun.applet.AppletPanel.run(AppletPanel.java:298)
    at java.lang.Thread.run(Thread.java:534)

    In my previous test programs, the same program run as application
    and as applet: is there something I missed to get an application
    run as an applet?

    thanx
    giammy
    , Jul 11, 2005
    #1
    1. Advertising

  2. Andrew Thompson, Jul 11, 2005
    #2
    1. Advertising

  3. John Currier Guest

    >From Class.newInstance() JavaDocs:

    * @exception InstantiationException
    * if this <code>Class</code> represents an abstract
    class,
    * an interface, an array class, a primitive type, or
    void;
    * or if the class has no nullary constructor;
    * or if the instantiation fails for some other
    reason.

    I believe "nullary" should be "no arg".

    You'll probably need to strip the applet down to the nothing and add
    pieces back in until it fails.

    John
    http://schemaspy.sourceforge.net
    John Currier, Jul 14, 2005
    #3
  4. On 13 Jul 2005 18:42:59 -0700, John Currier wrote:

    ....
    > You'll probably need to strip the applet down to the nothing and add
    > pieces back in until it fails.


    John, I was about to throw in 'as described here'[1].. but as
    I read your words more carefully I realised you were suggesting
    something slightly different.

    Would you object if I were to add this link to other
    times you might make that comment? Could I get away
    with 'much like..'?

    [1] <http://www.physci.org/codes/sscce.jsp>
    [ The only difference is that I suggest coming from the
    'opposite direction' and cutting down broken code until
    either it works or the problem disappears. ]
    [ I would have added this link on the response I made,
    but the site was down at the time. ]

    --
    Andrew Thompson
    physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
    Beats A Hard Kick In The Face
    Andrew Thompson, Jul 14, 2005
    #4
  5. John Currier Guest

    No objection here. The only reason I suggested the 'ground up'
    approach is that the problem probably isn't associated with something
    obvious (at least not to him). If he had recently made changes that
    prompted the new behavior then starting from the 'opposite direction'
    would have been obvious. Which end you choose to start at is based on
    experience in determining the odds of finding an answer first.

    Note that I normally wouldn't suggest the 'ground up' approach, but
    this is possibly a classloader issue that will require removal of big
    chunks of code. If it is a classloader issue then he might want to
    analyze the output of -verbose:class.

    John
    http://schemaspy.sourceforge.net
    John Currier, Jul 15, 2005
    #5
  6. On 14 Jul 2005 18:41:46 -0700, John Currier wrote:

    > No objection here. The only reason I suggested the 'ground up'
    > approach is that the problem probably isn't associated with something
    > obvious (at least not to him).


    Cool. Both approaches have merit, and often
    equate to the same fundamental principle.

    Isolate and simplify the problem.

    --
    Andrew Thompson
    physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
    == Proudly Made On Earth ==
    Andrew Thompson, Jul 15, 2005
    #6
    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. Rob Love

    applet vs. canvas in applet

    Rob Love, Jul 7, 2003, in forum: Java
    Replies:
    1
    Views:
    607
    Liu, Chunyen
    Jul 7, 2003
  2. webster
    Replies:
    0
    Views:
    844
    webster
    Jul 20, 2003
  3. Andrew Thompson
    Replies:
    0
    Views:
    402
    Andrew Thompson
    Aug 5, 2003
  4. zero
    Replies:
    4
    Views:
    797
  5. leiting
    Replies:
    0
    Views:
    1,399
    leiting
    Aug 17, 2007
Loading...

Share This Page