J
Jacob
In my main window I set up certain things based on the
availability of certain classes in my system.
I use Class.forName() to check if a certain class exists,
basically like this:
public boolean exists (String className)
{
try {
Class.forName (className);
return true;
}
catch (ClassNotFoundException exception) {
return false;
}
}
Apparently the forName() method does a lot of stuff I don't
want it to do at this point, like loading dependent classes
etc. I've also learned from a previous thread that it also
executes static initializers and so on.
Question is: Is there a more "lightweight" way to check if
a class exists or not?
Thanks!
availability of certain classes in my system.
I use Class.forName() to check if a certain class exists,
basically like this:
public boolean exists (String className)
{
try {
Class.forName (className);
return true;
}
catch (ClassNotFoundException exception) {
return false;
}
}
Apparently the forName() method does a lot of stuff I don't
want it to do at this point, like loading dependent classes
etc. I've also learned from a previous thread that it also
executes static initializers and so on.
Question is: Is there a more "lightweight" way to check if
a class exists or not?
Thanks!