> -----Original Message----- > From: Discussion list for Java 3D API > [mailto:[EMAIL PROTECTED]]On Behalf Of Andrea Boright > > It looks like the PackageInfo sample can be run as an application > only. I need to detect the presence of Java3D from a web browser > (IE6 or NS6.2), either via Javascript or a Java applet. > Preferable via javascript (or via parameters on the <object> > tag), since I'd like to warn them before any applets get loaded.
This is what I do in my application, which should work for an Applet (I don't think Class.forName() is a privileged operation): /** * Determine if Java 3D is installed. */ public static boolean isJ3DInstalled() { try { Class.forName("javax.media.j3d.Canvas3D"); } catch(Throwable ex) { return false; } return true; } You need to catch Throwable, not Exception, as the jar files may be available but not the shared libraries/DLLs, which results in an Error being thrown. If you run this as the first thing you do in your application (i.e. in your init() method, or even as a static block in your applet class), you could have the applet display some instructions or something in leu of instantiating any Java3D classes (in the event that isJ3DInstalled() returns false). Simeon /** * @author Simeon H.K. Fitch * @organization Mustard Seed Software * @web http://www.mustardseedsoftware.com * @email [EMAIL PROTECTED] * @voice 210.867.1616 * @fax 309.424.4982 */ =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".