Listar Porta Serial

Pessoal,

Estou iniciando o trabalho com java e api’s agora estou tentando usar a commapi para listar minhas portas seriais, executei toda a configuração dita no arquivo da Sun, e executo o SerialDemo, porém nenhuma porta é lista, uso o Eclipse e meu arquivo classpath esta assim:

[size=“9”]<?xml version=“1.0” encoding=“UTF-8”?>
<classpath>
<classpathentry kind=“src” path=“src”/> <classpathentry kind=“con” path=“org.eclipse.jdt.launching.JRE_CONTAINER”/>
<classpathentry kind=“lib” path=“C:/j2sdk1.4.2_04/lib/j2ee.jar”/>
<classpathentry kind=“lib” path=“C:/j2sdk1.4.2_04/lib/comm.jar”/>
<classpathentry kind=“output” path=“WEB-INF/classes”/>
</classpath>
[/size]

Segue também um trecho do arquivo java SimpleRead que acompanha o pacote, eu coloquei alguns System.out e notei que a linha System.out.println(“passo 02:”); nunca é executada

Peço por favor uma ajuda…
[b]
public static void main(String[] args) {
portList = CommPortIdentifier.getPortIdentifiers();

    System.out.println("passo 01:" + portList);
    while (portList.hasMoreElements()) {
    	System.out.println("passo 02:");
        portId = (CommPortIdentifier) portList.nextElement();
        if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
            // if (portId.getName().equals("COM1")) {
            if (portId.getName().equals("/dev/term/a")) {
                SimpleRead reader = new SimpleRead();
            }
        }
    }
}[/b]

Eu estou com o mesmo problema, utilizando o SerialDemo, com Sistema Operacional windows 98, se vc souber de alguma coisa, me avise.

Eu fiz desse jeito aki ó …
e deu certo …

Esta é a classe responsável por verificar as portas seriais …

[code]

import java.util.Enumeration;
import javax.comm.*;

public class SerialSupport {

public Enumeration listPortChoices() {

CommPortIdentifier portId;

Enumeration en = CommPortIdentifier.getPortIdentifiers&#40;&#41;;

return en;

}

}[/code]

Mostra em um combo box quais com´s estão disponíveis …


import java.util.Enumeration;

import javax.swing.JFrame;

import javax.comm.*;

import serial.SerialSupport;

//--------------------------------------------------------------------------//
// Autor&#58;Felipe Cunha															//
// Data&#58;06/09/2004																//
// 																			//
// controleRemotoView
public class SerialConfig extends JFrame &#123;

	static CommPortIdentifier portId;
	Enumeration en=null;
	SerialSupport serialsupport =new SerialSupport&#40;&#41;;
		

	private javax.swing.JPanel jContentPane = null;

	private javax.swing.JComboBox jComboBox = null;
	private javax.swing.JLabel jLabel = null;
	/**
	 * This is the default constructor
	 */
	public SerialConfig&#40;&#41; &#123;
		super&#40;&#41;;
		initialize&#40;&#41;;
	&#125;
	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize&#40;&#41; &#123;
		this.setSize&#40;258, 200&#41;;
		this.setContentPane&#40;getJContentPane&#40;&#41;&#41;;
		this.setVisible&#40;true&#41;;
	&#125;
	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private javax.swing.JPanel getJContentPane&#40;&#41; &#123;
		if &#40;jContentPane == null&#41; &#123;
			jContentPane = new javax.swing.JPanel&#40;&#41;;
			jContentPane.setLayout&#40;null&#41;;
			jContentPane.add&#40;getJComboBox&#40;&#41;, null&#41;;
			jContentPane.add&#40;getJLabel&#40;&#41;, null&#41;;
		&#125;
		return jContentPane;
	&#125;
	/**
	 * This method initializes jComboBox
	 * 
	 * @return javax.swing.JComboBox
	 */
	private javax.swing.JComboBox getJComboBox&#40;&#41; &#123;
		if&#40;jComboBox == null&#41; &#123;
			jComboBox = new javax.swing.JComboBox&#40;&#41;;
			jComboBox.setBounds&#40;32, 61, 146, 19&#41;;
			
			en=serialsupport.listPortChoices&#40;&#41;; 
			while &#40;en.hasMoreElements&#40;&#41;&#41; &#123;
				portId = &#40;CommPortIdentifier&#41; en.nextElement&#40;&#41;;
				if &#40;portId.getPortType&#40;&#41; == CommPortIdentifier.PORT_SERIAL&#41; &#123;
					jComboBox.addItem&#40;portId.getName&#40;&#41;&#41;;
				&#125;
			&#125;
			
		&#125;
		return jComboBox;
	&#125;
	/**
	 * This method initializes jLabel
	 * 
	 * @return javax.swing.JLabel
	 */
	private javax.swing.JLabel getJLabel&#40;&#41; &#123;
		if&#40;jLabel == null&#41; &#123;
			jLabel = new javax.swing.JLabel&#40;&#41;;
			jLabel.setBounds&#40;15, 20, 233, 29&#41;;
			jLabel.setText&#40;&quot;Soh pra debug, mostra a com q está disponível&quot;&#41;;
		&#125;
		return jLabel;
	&#125;
&#125;  //  @jve&#58;visual-info  decl-index=0 visual-constraint=&quot;10,10&quot;