Detect if Swing is installed (this howto is deprecated)Tag(s): DEPRECATED
About cookies on this site
We use cookies to collect and analyze information on site performance and usage,
to provide social media features and to enhance and customize content and advertisements.
public class SwingSniffer extends java.applet.Applet {
public void init() {
try {
com.sun.java.swing.JButton dummy =
new com.sun.java.swing.JButton("foo");
System.out.println("Swing is here");
// getAppletContext().showDocument
// (new URL(getCodeBase()+"AppletPageWithNoArchiveTag.html"));
}
catch(Exception e) {
System.out.println
("Swing is not here, you must download or install it");
// getAppletContext().showDocument
// (new URL(getCodeBase()+"AppletPageWithArchiveTag.html"));
}
}
}
<HTML><HEAD></HEAD><BODY>
<APPLET CODE="SwingSniffer.class"
HEIGHT=1 WIDTH=1>
<A HREF="/nojava.html">
Oups! You don't have JAVA enabled, click here.</A>
</APPLET>
</BODY></HTML>