Loading Classes

Right now, I'm learning java on my own. I need help.Is there a way to find out if a class(applet) was fully loaded with an if-else statement?Thanks!!!
[172 byte] By [JustAnotherProgramera] at [2007-9-19]
# 1

If you issue this statement:

try {

Class.forName("MyClass");

} catch(ClassNotFoundException) {

//if you arrive here, it means that your class will never

//be loaded because it is not in your classpath

}

execution will block untill class MyClass is loaded...

Hope it helps

jummoMa1a at 2007-7-8 > top of java,Archived Forums,Java Programming [Archive]...
# 2

Sorry, I forgot the exception variable name:

try { Class.forName("MyClass"); }

catch(ClassNotFoundException cnfe) {

//if you arrive here, it means that your class will never

//be loaded because it is not in your classpath

}

jummoMa1a at 2007-7-8 > top of java,Archived Forums,Java Programming [Archive]...
# 3
I just want to know if it was initiated with an if-else statement.Thanks
JustAnotherProgramera at 2007-7-8 > top of java,Archived Forums,Java Programming [Archive]...
# 4

What you mean "if it was initiated"? Where do you plan to perform your test? Within the applet itself? I mean, if you put your code in the init() method, you know the applet is loaded; if you put your code in the start() method, you know the applet is starting; if you put your code in the paint() method, you know the applet is needed to repaint herself; if you are in another thread, well you should test some boolean property you'll set to true at the end of the start method. The same if you want to perform the test from outside the applet (in another applet or from javascript code).

Hope it helps...

jummoMa1a at 2007-7-8 > top of java,Archived Forums,Java Programming [Archive]...
# 5

> What you mean "if it was initiated"? Where do

> you plan to perform your test? Within the applet

> itself? I mean, if you put your code in the init()

> method, you know the applet is loaded; if you put your

> code in the start() method, you know the applet is

> starting; if you put your code in the paint() method,

> you know the applet is needed to repaint herself; if

> you are in another thread, well you should test some

> boolean property you'll set to true at the end of the

> start method. The same if you want to perform the test

> from outside the applet (in another applet or from

> javascript code).

>

> Hope it helps...

Within the applet. I just want to know if it was loaded.

JustAnotherProgramera at 2007-7-8 > top of java,Archived Forums,Java Programming [Archive]...
# 6
I think - so I am. (Descartes) .. and now try to generalize for an applet. Sorry, Descartes didn't even know what this was.
thpreussera at 2007-7-8 > top of java,Archived Forums,Java Programming [Archive]...
# 7
Cogito ergo sum..Sharp idea :-)
jummoMa1a at 2007-7-8 > top of java,Archived Forums,Java Programming [Archive]...
# 8
http://forum.java.sun.com/thread.jsp?forum=13&thread=199252
thomaswwwa at 2007-7-8 > top of java,Archived Forums,Java Programming [Archive]...
# 9
Never mind. I been so stupid. I can just check in the init.
JustAnotherProgramera at 2007-7-8 > top of java,Archived Forums,Java Programming [Archive]...