The JavaVM will throw a ClassNotFoundException because it will try to
preload the class in case you do use the method.
> I'm becoming convinced that we need to support character streams in
> SAX, and I'm trying to figure out how to handle it in the Java
> version -- I think that I've worked out pretty much everything else
> now, except for a few minor details.
I'm dealing with a similar problem on an applet at work where I need to be
able to support the Java Media Framework for sound if available. My
solution is to abstract everything that references the possibly missing
classes into a second class, then in build an initialization routine like
the following:
Class parserClass; // used if creating several Parser objects
Parser parser = null; // Parser is an abstract class or interface
// Used if only need one parser
void init() {
try {
Class.forName( "java.io.Reader" ); // checks if supported
parserClass = Class.forName( "MyParserFor11" );
} catch( ClassNotFoundException err ) {
parserClass = Class.forName( "MyParserFor10" );
}
try {
parser = (Parser) parserClass.newInstance();
} catch( InstantiationException err ) { // Constructor requires argument
} catch( IllegalAccessException err ) { // Constructor isn't public
}
}
NOTE: Apparently my understandings reflected Don Park's >>original<<
message which is apparently wrong. But even so, the above will still work.
Andrew n marshall
student - artist - programmer
http://www.media-electronica.com/anm-bin/anm
"Everyone a mentor, Everyone a pupil"
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)