NullPointerException at FindAppletJDKLevel(unknown source)
Hello,
I am attempting to embed an applet in html and I am running into an error which I cannot find much documentation about. I receive the following:
java.lang.NullPointerException
at sun.plugin2.applet.Plugin2Manager.findAppletJDKLev el(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unk nown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionR unnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.lang.NullPointerException
I used Netbeans 6.5.1 with jdk1.6.0_14 to develop this applet and it utilizes third-party proprietary libraries. The applet runs in Netbeans. Here is the applet:
import java.awt.*;
import java.awt.event.*;
import java.beans.Beans;
import javax.swing.*;
import java.applet.Applet;
import java.awt.GridLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.comm.CommDriver;
import com.topaz.sigplus.SigPlus;
import com.topaz.sigplus.SigPlusEvent0;
import com.topaz.sigplus.SigPlusListener;
public class SigApplet extends Applet {
private JPanel p1 = new JPanel(new GridLayout(1,1));
private JPanel p2 = new JPanel(new FlowLayout(FlowLayout.CENTER));
private JButton jbtSign;
private JButton jbtClear;
private JButton jbtSubmit;
private SigPlus sigObj;
public void init() {
super.init();
setLayout(new GridLayout(2,1));
// SigApplet demo = new SigApplet();
try
{
jbtSign = new JButton("Sign");
jbtClear = new JButton("Clear");
jbtSubmit = new JButton("Submit");
p2.add(jbtSign);
p2.add(jbtClear);
p2.add(jbtSubmit);
add(p1, BorderLayout.CENTER);
add(p2, BorderLayout.SOUTH);
jbtSign.addActionListener(new jbtSignListener());
jbtClear.addActionListener(new jbtClearListener());
ClassLoader cl = (com.topaz.sigplus.SigPlus.class).getClassLoader() ;
sigObj = (SigPlus)Beans.instantiate( cl, "com.topaz.sigplus.SigPlus" );
setLayout( new GridLayout( 1, 1 ) );
p1.add( sigObj );
sigObj.addSigPlusListener( new SigPlusListener()
{
public void handleTabletTimerEvent( SigPlusEvent0 evt )
{
}
public void handleNewTabletData( SigPlusEvent0 evt )
{
}
public void handleKeyPadData( SigPlusEvent0 evt )
{
}
} );
setSize( 350, 150 );
show();
sigObj.setTabletModel( "SignatureGemLCD1X5" );
sigObj.setTabletComPort( "HID1" );
sigObj.setTabletState( 0 );
}
catch ( Exception e )
{
return;
}
}
public void start() {
super.start();
}
private class jbtSignListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
sigObj.setTabletState(1);
}
}
private class jbtClearListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
sigObj.clearTablet();
}
}
}
I then self-sign this jar with a certificate I generated with keytool and then drop it and the classes generated by Netbeans into a directory with an HTML with the following implementation:
<html>
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<applet code="SigApplet.class" archive="SigApplet.jar" height="200" width="300"></applet>
</div>
</form>
</body>
</html>
I get the certificate screen, but once I accept it, I receive the NullPointerException at FindAppletJDKLevel. I've also tried using the object tag and I get the same error. Following the same methods above I was able to get a simple loan calculator applet to load in a browser. Any thoughts?
Thanks,
Pete
|