Salve a tutti

devo realizzare un applet java che comunichi con la porta seriale, ho realizzato correttamente la firma e tutto il resto e sto utilizzando le librerie RXTXcomm per poter comunicare.

il codice è il seguente:

codice:
package microcom;

import javax.swing.JApplet;
import gnu.io.*;
import java.io.*;
import java.util.*;

public class comApplet extends JApplet {

    static Enumeration portList;
    static CommPortIdentifier portId;
    static String messageString = "\"articolo\"500H1R\n1T";
    static String param = "";
    static SerialPort serialPort;
    static OutputStream outputStream;
  
    /**
     * Initialization method that will be called after the applet is loaded
     * into the browser.
     */
    @Override
    public void init() {
      
       //System.setSecurityManager(null);             
       
       comApplet.class.getClassLoader().getResource("RXTXcomm.jar");                           
      
       portList = CommPortIdentifier.getPortIdentifiers();
            while (portList.hasMoreElements()) {
            portId = (CommPortIdentifier) portList.nextElement();
            if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
                 if (portId.getName().equals("COM1")) {
                //if (portId.getName().equals("/dev/term/a")) {
                    try {
                        serialPort = (SerialPort)
                            portId.open("SimpleWriteApp", 2000);                            
                    } catch (PortInUseException e) {}
                    try {
                        outputStream = serialPort.getOutputStream();
                    } catch (IOException e) {}
                    try {
                        serialPort.setSerialPortParams(9600,
                            SerialPort.DATABITS_8,
                            SerialPort.STOPBITS_1,
                            SerialPort.PARITY_NONE);
                    } catch (UnsupportedCommOperationException e) {}
                    try {
                        outputStream.write(messageString.getBytes());
                    } catch (IOException e) {
                    
                       
                    
                    }
                }
            }
        }           
    
    System.exit(0);
    }
    
    
    
    // TODO overwrite start(), stop() and destroy() methods
}
quando eseguo il codice però se sono sotto netbeans funziona mentre se lo metto sotto il browser, mi chiede correttamente di accettare il certificato ma poi mi da il seguente errore:

Exception in thread "thread applet-microcom/comApplet.class-2" java.lang.NoClassDefFoundError: Could not initialize class gnu.io.CommPortIdentifier
at microcom.comApplet.init(comApplet.java:31)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionR unnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

io ho eseguito qualche ricerca e tempo fa un utente del forum ha avuto lo stesso problema e l'ha risolto inserendo questo comando: System.setSecurityManager(null); e gli è andata bene... ora però il l'ho remmato perché se lo metto mi da errore di security manager... qualcuno sa darmi un consiglio? GRAZIE!!!!