InstantiationException running an applet

G

giangiammy

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
 
A

Andrew Thompson

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 ...

URL? (If it is not on the web yet, you might put it
up at a free site for the moment)
 
J

John Currier

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
 
A

Andrew Thompson

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. ]
 
J

John Currier

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
 
A

Andrew Thompson

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.
 

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

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,739
Latest member
Clint8040

Latest Threads

Top