Port Programming Using Netbeans

Hello everybody,
I am working on Serial port communication, and I have used Netbeans for GUI designing.
I am able access the port, but failed to set Event for the same.
I am getting error like............
D:\NetBeansProjects\MySerialPort\src\readserialport\MyComport.java:20: readserialport.MyComport is not abstract and does not override abstract method serialEvent(javax.comm.SerialPortEvent) in javax.comm.SerialPortEventListener
Please help me to resolve this problem...............
My code:
* MyComport.java
* Created on March 18, 2008, 5:43 PM
package readserialport;
import java.awt.*;
import java.io.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.comm.*;
import java.util.*;
* @author pbagde
class MyComport extends javax.swing.JFrame
implements SerialPortEventListener{
/** How long to wait for the open to finish up. **/
public static final int TIMEOUTSECONDS = 30;
/** The chosen Port Identifier **/
CommPortIdentifier thePortID;
/** The chosen Port itself **/
CommPort thePort;
/** A mapping from names to CommPortIdentifiers. **/
protected HashMap map = new HashMap();
/** The name of the choice the user made. **/
protected String selectedPortName;
/** The CommPortIdentifier the user chose. **/
//SerialEvent Mytest;
//PortChooser MyPort = new PortChooser(null);
SerialPortEventListener SEvent;
InputStream inputStream;
OutputStream outputStream;
protected CommPortIdentifier selectedPortIdentifier;
/** Creates new form MyComport */
public MyComport(){
initComponents();
InitializeComponentValues();
public void InitializeComponentValues(){
// get list of ports available on this particular computer,
// by calling static method in CommPortIdentifier.
Enumeration pList = CommPortIdentifier.getPortIdentifiers();
// Process the list, putting serial and parallel into ComboBoxes
while (pList.hasMoreElements()) {
CommPortIdentifier cpi = (CommPortIdentifier) pList.nextElement();
System.out.println("Port " + cpi.getName());
map.put(cpi.getName(), cpi);
if (cpi.getPortType() == CommPortIdentifier.PORT_SERIAL) {
comportCMB.addItem(cpi.getName());
} else if (cpi.getPortType() == CommPortIdentifier.PORT_PARALLEL) {
//parallelPortsChoice.setEnabled(true);
//parallelPortsChoice.addItem(cpi.getName());
} else {
//other.addItem(cpi.getName());
public void SerialPortEvent(SerialPortEvent SEvent){
switch(SEvent.getEventType()){
case SerialPortEvent.BI:
case SerialPortEvent.CD:
case SerialPortEvent.CTS:
case SerialPortEvent.DSR:
case SerialPortEvent.FE:
case SerialPortEvent.OE:
case SerialPortEvent.PE:
case SerialPortEvent.RI:
case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
break;
case SerialPortEvent.DATA_AVAILABLE:
StringBuffer readBuffer = new StringBuffer();
System.out.println(readBuffer);
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
comportCMB = new javax.swing.JComboBox();
jLabel2 = new javax.swing.JLabel();
baudCMB = new javax.swing.JComboBox();
jLabel3 = new javax.swing.JLabel();
databitsCMB = new javax.swing.JComboBox();
jLabel4 = new javax.swing.JLabel();
parityCMB = new javax.swing.JComboBox();
jLabel5 = new javax.swing.JLabel();
stopbitsCMB = new javax.swing.JComboBox();
jLabel6 = new javax.swing.JLabel();
flowconCMB = new javax.swing.JComboBox();
connectBTN = new javax.swing.JButton();
disconnectBTN = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jPanel3 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
receiveTBX = new javax.swing.JTextArea();
jPanel4 = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
sendTBX = new javax.swing.JTextArea();
sendBTN = new javax.swing.JButton();
menuBar = new javax.swing.JMenuBar();
fileMenu = new javax.swing.JMenu();
openMenuItem = new javax.swing.JMenuItem();
saveMenuItem = new javax.swing.JMenuItem();
saveAsMenuItem = new javax.swing.JMenuItem();
exitMenuItem = new javax.swing.JMenuItem();
editMenu = new javax.swing.JMenu();
cutMenuItem = new javax.swing.JMenuItem();
copyMenuItem = new javax.swing.JMenuItem();
pasteMenuItem = new javax.swing.JMenuItem();
deleteMenuItem = new javax.swing.JMenuItem();
helpMenu = new javax.swing.JMenu();
contentsMenuItem = new javax.swing.JMenuItem();
aboutMenuItem = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Serial Port");
setMinimumSize(new java.awt.Dimension(552, 351));
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Serial Port Configuration", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Verdana", 1, 12)));
jLabel1.setFont(new java.awt.Font("Verdana", 0, 11));
jLabel1.setText("Connect Using :");
comportCMB.setFont(new java.awt.Font("Verdana", 0, 11));
jLabel2.setFont(new java.awt.Font("Verdana", 0, 11));
jLabel2.setText("Bits Per Second :");
baudCMB.setFont(new java.awt.Font("Verdana", 0, 11));
baudCMB.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "110", "300", "1200", "2400", "4800", "9600", "19200", "38400", "57600", "115200", "230400", "460800", "921600" }));
jLabel3.setFont(new java.awt.Font("Verdana", 0, 11));
jLabel3.setText("Data Bits :");
databitsCMB.setFont(new java.awt.Font("Verdana", 0, 11));
databitsCMB.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "5", "6", "7", "8" }));
jLabel4.setFont(new java.awt.Font("Verdana", 0, 11));
jLabel4.setText("Parity :");
parityCMB.setFont(new java.awt.Font("Verdana", 0, 11));
parityCMB.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Even", "Odd", "None", "Mark", "Space" }));
jLabel5.setFont(new java.awt.Font("Verdana", 0, 11));
jLabel5.setText("Stop Bits :");
stopbitsCMB.setFont(new java.awt.Font("Verdana", 0, 11));
stopbitsCMB.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "1.5", "2" }));
jLabel6.setFont(new java.awt.Font("Verdana", 0, 11));
jLabel6.setText("Flow Control :");
flowconCMB.setFont(new java.awt.Font("Verdana", 0, 11));
flowconCMB.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Xon/Xoff In", "Xon/Xoff Out", "RTS/CTS In", "RTS/CTS Out", "None" }));
connectBTN.setFont(new java.awt.Font("Verdana", 0, 11));
connectBTN.setLabel("Connect");
connectBTN.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
connectBTNActionPerformed(evt);
disconnectBTN.setFont(new java.awt.Font("Verdana", 0, 11));
disconnectBTN.setLabel("Disconnect");
disconnectBTN.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
disconnectBTNActionPerformed(evt);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jLabel4)
.addComponent(jLabel5)
.addComponent(jLabel6))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(disconnectBTN, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(flowconCMB, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(stopbitsCMB, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(parityCMB, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(databitsCMB, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(baudCMB, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comportCMB, 0, 86, Short.MAX_VALUE)
.addComponent(connectBTN, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap(19, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(comportCMB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(baudCMB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(databitsCMB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(parityCMB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(stopbitsCMB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(flowconCMB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(connectBTN)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(disconnectBTN))
jLabel1.getAccessibleContext().setAccessibleName("");
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Data Communication", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Verdana", 1, 12)));
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Receive Data", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Verdana", 0, 12)));
receiveTBX.setColumns(20);
receiveTBX.setRows(5);
jScrollPane1.setViewportView(receiveTBX);
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 214, Short.MAX_VALUE)
.addContainerGap())
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 63, Short.MAX_VALUE)
.addContainerGap())
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Send Data", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Verdana", 0, 12)));
sendTBX.setColumns(20);
sendTBX.setRows(5);
jScrollPane2.setViewportView(sendTBX);
sendBTN.setLabel("Send");
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 214, Short.MAX_VALUE)
.addComponent(sendBTN, javax.swing.GroupLayout.Alignment.TRAILING))
.addContainerGap())
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(sendBTN))
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
fileMenu.setText("File");
openMenuItem.setText("Open");
fileMenu.add(openMenuItem);
saveMenuItem.setText("Save");
fileMenu.add(saveMenuItem);
saveAsMenuItem.setText("Save As ...");
fileMenu.add(saveAsMenuItem);
exitMenuItem.setText("Exit");
exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
exitMenuItemActionPerformed(evt);
fileMenu.add(exitMenuItem);
menuBar.add(fileMenu);
editMenu.setText("Edit");
cutMenuItem.setText("Cut");
editMenu.add(cutMenuItem);
copyMenuItem.setText("Copy");
editMenu.add(copyMenuItem);
pasteMenuItem.setText("Paste");
editMenu.add(pasteMenuItem);
deleteMenuItem.setText("Delete");
editMenu.add(deleteMenuItem);
menuBar.add(editMenu);
helpMenu.setText("Help");
contentsMenuItem.setText("Contents");
helpMenu.add(contentsMenuItem);
aboutMenuItem.setText("About");
helpMenu.add(aboutMenuItem);
menuBar.add(helpMenu);
setJMenuBar(menuBar);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
pack();
}// </editor-fold>
private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {                                            
System.exit(0);
private void connectBTNActionPerformed(java.awt.event.ActionEvent evt) {                                          
// TODO add your handling code here:
// Get the CommPortIdentifier.
thePortID = getSelectedIdentifier();
System.out.println("Trying to open " + thePortID.getName() + "...");
try{
thePort = thePortID.open("DarwinSys DataComm", TIMEOUTSECONDS * 1000);
SerialPort myPort = (SerialPort) thePort;
SEvent = (SerialPortEventListener) thePort;
//SEvent.serialEvent();
myPort.setSerialPortParams(getBaud(), getDataBits(), getStopBits(), getParity());
myPort.getFlowControlMode();
myPort.notifyOnDataAvailable(true);
myPort.addEventListener(this);
inputStream = myPort.getInputStream();
} catch (TooManyListenersException ex) {
Logger.getLogger(MyComport.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(MyComport.class.getName()).log(Level.SEVERE, null, ex);
} catch (UnsupportedCommOperationException ex) {
Logger.getLogger(MyComport.class.getName()).log(Level.SEVERE, null, ex);
} catch (PortInUseException ex) {
Logger.getLogger(MyComport.class.getName()).log(Level.SEVERE, null, ex);
} //catch(TooManyListenersException e) {}
System.out.println("Trying to open with BAUD " + getBaud());
System.out.println("Trying to open with DataBits " + getDataBits());
System.out.println("Trying to open with Parity " + getParity());
System.out.println("Trying to open with StopBits " + getStopBits());
System.out.println("Trying to open with FlowControl " + getFlowControlMode());
/* The public "getter" to retrieve the selection by CommPortIdentifier. */
public CommPortIdentifier getSelectedIdentifier() {
selectedPortName = (String) comportCMB.getSelectedItem();
// Get the given CommPortIdentifier
selectedPortIdentifier = (CommPortIdentifier)map.get(selectedPortName);
return selectedPortIdentifier;
private void disconnectBTNActionPerformed(java.awt.event.ActionEvent evt) {                                             
// TODO add your handling code here:
thePortID = getSelectedIdentifier();
thePort.close();
System.out.println("Closed " + thePortID.getName() + "...");
public int getBaud(){
int baud;
baud = Integer.parseInt((String) baudCMB.getSelectedItem()) ;
return baud;
public int getDataBits(){
int databits;
databits = Integer.parseInt((String) databitsCMB.getSelectedItem());
return databits;
public int getParity(){
String parity;
parity = (String) parityCMB.getSelectedItem();
if(parity.equals("Even"))
return SerialPort.PARITY_EVEN;
else if(parity.equals("Odd"))
return SerialPort.PARITY_ODD;
else if(parity.equals("Mark"))
return SerialPort.PARITY_MARK;
else if (parity.equals("Space"))
return SerialPort.PARITY_SPACE;
else
return SerialPort.PARITY_NONE;
public int getStopBits(){
String stopbits;
stopbits = (String) stopbitsCMB.getSelectedItem();
if(stopbits.equals("1"))
return SerialPort.STOPBITS_1;
else if(stopbits.equals("1.5"))
return SerialPort.STOPBITS_1_5;
else
return SerialPort.STOPBITS_2;
public int getFlowControlMode(){
String flowcontrol;
flowcontrol = (String)flowconCMB.getSelectedItem();
if(flowcontrol.equals("Xon/Xoff In"))
return SerialPort.FLOWCONTROL_XONXOFF_IN;
else if(flowcontrol.equals("Xon/Xoff Out"))
return SerialPort.FLOWCONTROL_XONXOFF_OUT;
else if(flowcontrol.equals("RTS/CTS In"))
return SerialPort.FLOWCONTROL_RTSCTS_IN;
else if(flowcontrol.equals("RTS/CTS Out"))
return SerialPort.FLOWCONTROL_RTSCTS_OUT;
else
return SerialPort.FLOWCONTROL_NONE;
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MyComport().setVisible(true);
// Variables declaration - do not modify
private javax.swing.JMenuItem aboutMenuItem;
private javax.swing.JComboBox baudCMB;
public javax.swing.JComboBox comportCMB;
private javax.swing.JButton connectBTN;
private javax.swing.JMenuItem contentsMenuItem;
private javax.swing.JMenuItem copyMenuItem;
private javax.swing.JMenuItem cutMenuItem;
private javax.swing.JComboBox databitsCMB;
private javax.swing.JMenuItem deleteMenuItem;
private javax.swing.JButton disconnectBTN;
private javax.swing.JMenu editMenu;
private javax.swing.JMenuItem exitMenuItem;
private javax.swing.JMenu fileMenu;
private javax.swing.JComboBox flowconCMB;
private javax.swing.JMenu helpMenu;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JMenuBar menuBar;
private javax.swing.JMenuItem openMenuItem;
private javax.swing.JComboBox parityCMB;
private javax.swing.JMenuItem pasteMenuItem;
private javax.swing.JTextArea receiveTBX;
private javax.swing.JMenuItem saveAsMenuItem;
private javax.swing.JMenuItem saveMenuItem;
private javax.swing.JButton sendBTN;
private javax.swing.JTextArea sendTBX;
private javax.swing.JComboBox stopbitsCMB;
// End of variables declaration
}

Thank you, for your kind reply......
I tried for plain java coding, it is worling fine.
It is receiving data on events from my harware.
But problem while I implement SerialPorteventHandler.
I am working on Netbeans 6.0.1
MyCODE : -------
class MyComport extends javax.swing.JFrame implements SerialPortEventListener{
          // My CODE
}This give error like.....
readserialport.MyComport is not abstract and does not override abstract method serialEvent(javax.comm.SerialPortEvent) in javax.comm.SerialPortEventListener
If I remove this SerialPortEventListener then it doesn't allow me to add event listener.....
myport.addeventlistner(this);I tried to solve this problem other way, but failed...
Please help me to sola this problem....

Similar Messages

  • Bank Account Program (using netbeans)

    Can someone please help me with this program I'm trying to create, I'm new to java and am a bit stuck ..
    I created a BankAccount class and want the following capabilities. The bank will be charging a fee for every deposit and withdrawal. Supply a mechanism for setting the fee and modify the deposit and withdraw methods so that the fee is levied. Test your resulting class and check that the fee is computed correctly.
    The bank will allow a fixed number of free transactions (7 deposits or withdrawals) every month, and charge for transactions exceeding the free allotment. The charge is not levied immediately but at the end of the month.
    Supply a new method deductMonthlyCharge to the BankAccount class that deducts the monthly charge and resets the transaction count.
    Produce a test program that verifies that the fees are calculated correctly over several months.
    Enable user input for each program. The input will be used to create the objects.
    Program continues to loop until user chooses to Quit.
    My current code:
    //Main
    package bank;
    import java.util.Scanner;
    public class Main {
        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
          BankAccount david = new BankAccount();
            System.out.println(david.getBalance() + " is the balance!");
            System.out.println("how much d");
            String deposit =  in.next();
            david.makeDeposit (double deposit)
            david.makeWithdrawl(50);
            System.out.println(david.getBal/ance() + " is the balance!");
            BankAccount jonathan = new BankAccount(125779, 768.34, "Jonathan", "Checking");
            System.out.println(jonathan.getBalance() + " is the balance!");
    //Class
    package bank;
    public class BankAccount {
        private int accountNumber;
        private int fee=20;
        private double balance;
        private String name;
        private String typeOfAccount;
        public BankAccount()
            accountNumber = 0;
            balance = 0;
            name = "No Name";
            typeOfAccount = "None";
        //Default constructor
        public BankAccount(int accountNumber, double balance, String name,
                String typeOfAccount)
             this.accountNumber = accountNumber;
             this.balance = balance;
             this.name = name;
             this.typeOfAccount = typeOfAccount;
        //Deposit!
        public double makeDeposit(double deposit)
            balance = balance + deposit - fee;
            //balance += deposit;
            return balance;
        //Withdrawl!
        public void makeWithdrawl(double withdrawl)
            balance = balance - withdrawl - fee;
        //Get balance!
        public double getBalance()
            return balance;
    }As you can see I'm probably way off :/ please helps me I would really like to get this done by Monday or as soon as possible.. Thank you very muchs :]

    Thank you :] scanner.nextDouble(); worked :]
    But my if else don't work is the format on them wrong?
    New code:
        package bank;
    import java.util.Scanner;
    public class Main {
        public static void main(String[]args)
            Scanner in = new Scanner(System.in);
            System.out.println("What is your account number?");
          String accountNumber =  in.next();
         if (accountNumber = 125778)
            BankAccount david = new BankAccount(125778, 800.34, "david", "Checking");
            System.out.println("Acount Number:" + accountNumber +"   "+ "Current Balance:" + "$" +david.getBalance());
            System.out.println("How much do you want to deposit");
            double deposit =  in.nextDouble();
            david.makeDeposit (deposit);
            System.out.println("How much do you want to withdrawl");
            double withdrawl =  in.nextDouble();
            david.makeWithdrawl (withdrawl);
            System.out.println(david.getBalance() + " is the new balance!");
            if (accountNumber = 125779)
            BankAccount john = new BankAccount(125779, 768.34, "john", "Checking");
            System.out.println("How much do you want to deposit");
            double deposit =  in.nextDouble();
            john.makeDeposit (deposit);
            System.out.println("How much do you want to withdrawl");
            double withdrawl =  in.nextDouble();
            john.makeWithdrawl (withdrawl);
            System.out.println(john.getBalance() + " is the new balance!");
            else
            System.out.println("Wrong acct");
    public BankAccount()
            accountNumber = 0;
            balance = 0;
            name = "No Name";
            typeOfAccount = "None";
        //Default constructor
        public BankAccount(int accountNumber, double balance, String name,
                String typeOfAccount)
             this.accountNumber = accountNumber;
             this.balance = balance;
             this.name = name;
             this.typeOfAccount = typeOfAccount;
        //Acoount
        public int getAccountNumber()
            return accountNumber;
        //Deposit!
        public double makeDeposit(double deposit)
            balance = balance + deposit - fee;
            //balance += deposit;
            return balance;
        //Withdrawl!
        public void makeWithdrawl(double withdrawl)
            balance = balance - withdrawl - fee;
        //Get balance!
        public double getBalance()
            return balance;
    }

  • How to create desktop application for simple server program using netbeans?

    Hi,can anyone help me on this one??
    I'm am very new to java,and I already trying different example program to create desktop applications
    for simple server program but it's not working.
    This is the main program for the simple server.
    import java.io.*;
    import java.net.*;
    public class Server {
    * @param args the command line arguments
    public static void main(String[] args) {
    try{
    ServerSocket serverSocket = new ServerSocket(4488);
    System.out.println("Server is waiting for an incoming connection on port 4488");
    Socket socket = serverSocket.accept();
    System.out.println(socket.getInetAddress() + "connected");
    PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
    BufferedReader in = new BufferedReader( new InputStreamReader(socket.getInputStream()));
    String inputLine;
    while ((inputLine = in.readLine()) != null){
    out.println(inputLine);
    System.out.println("Connection will be cut");
    out.close();
    in.close();
    socket.close();
    serverSocket.close();
    }catch(IOException e){
    e.printStackTrace();
    // TODO code application logic here
    }

    and this is the Main Processing :
    import java.awt.*;
    import java.awt.event.*;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.swing.*;
    import java.text.*;
    import java.util.*;
    import java.net.*;
    import java.io.*;
    public class MainProcessing {
    private static final long serialVersionUID = 1L;
    static private boolean isApplet_ = true;
    static private InetAddress argIp_ = null;
    static private int argPort_ = 0;
    public TCPIP TCPIP_ = null;
    private InetAddress ip_ = null;
    private int port_ = 10001;
    static private boolean conectFlag = false;
    private BufferedWriter bw;
    FileOutputStream fos;
    OutputStreamWriter osw;
    public int[] current = new int[400];
    public int[] volt = new int[400];
    public int[] revolution = new int[400];
    public void init() {
    public void start() {
    if (isApplet_) {
    try {
    ip_ = InetAddress.getByName(getCodeBase().getHost());
    } catch (UnknownHostException e) {
    } else {
    ip_ = argIp_;
    if (argPort_ != 0) {
    port_ = argPort_;
    // IP&#12450;&#12489;&#12524;&#12473;&#12364;&#19981;&#26126;&#12394;&#12425;&#20309;&#12418;&#12375;&#12394;&#12356;
    if (ip_ != null) {
    // &#12467;&#12493;&#12463;&#12471;&#12519;&#12531;&#12364;&#25104;&#31435;&#12375;&#12390;&#12356;&#12394;&#12356;&#12394;&#12425;&#12289;&#25509;&#32154;
    if (TCPIP_ == null) {
    TCPIP_ = new TCPIP(ip_, port_);
    if (TCPIP_.getSocket_() == null) {
    System.out.println("&#12511;&#12473;&#65297;");
    // &#12456;&#12521;&#12540;&#12513;&#12483;&#12475;&#12540;&#12472;&#12434;&#34920;&#31034;
    return;
    if (TCPIP_ == null) {
    System.out.println("&#12511;&#12473;&#65298;");
    return;
    System.out.println("&#25104;&#21151;");
    conectFlag = true;
    try {
    TCPIP_.sendF();
    } catch (IOException ex) {
    Logger.getLogger(MainProcessing.class.getName()).log(Level.SEVERE, null, ex);
    System.out.println("" + conectFlag);
    return;
    public void receive() {
    try {
    // Calendar cal1 = Calendar.getInstance(); //(1)&#12458;&#12502;&#12472;&#12455;&#12463;&#12488;&#12398;&#29983;&#25104;
    // int year = cal1.get(Calendar.YEAR); //(2)&#29694;&#22312;&#12398;&#24180;&#12434;&#21462;&#24471;
    // int month = cal1.get(Calendar.MONTH) + 1; //(3)&#29694;&#22312;&#12398;&#26376;&#12434;&#21462;&#24471;
    // int day = cal1.get(Calendar.DATE); //(4)&#29694;&#22312;&#12398;&#26085;&#12434;&#21462;&#24471;
    // int hour = cal1.get(Calendar.HOUR_OF_DAY); //(5)&#29694;&#22312;&#12398;&#26178;&#12434;&#21462;&#24471;
    // int min = cal1.get(Calendar.MINUTE); //(6)&#29694;&#22312;&#12398;&#20998;&#12434;&#21462;&#24471;
    // int sec = cal1.get(Calendar.SECOND); //(7)&#29694;&#22312;&#12398;&#31186;&#12434;&#21462;&#24471;
    byte[] rev = TCPIP_.receive();
    // System.out.println("&#21463;&#20449;");
    if (rev != null) {
    byte[] Change = new byte[1];
    int j = 0;
    for (int i = 0; i < 1200; i++) {
    Change[0] = rev;
    current[j] = decimalChange(Change);
    i++;
    Change[0] = rev[i];
    volt[j] = decimalChange(Change);
    i++;
    Change[0] = rev[i];
    revolution[j] = decimalChange(Change);
    } catch (NullPointerException e) {
    public int decimalChange(byte[] byteData) {
    int bit0, bit1, bit2, bit3, bit4, bit5, bit6, bit7;
    int bit = 0;
    for (int i = 0; i < 8; i++) {
    int a = (byteData[0] >> i) & 1;
    System.out.print(a);
    System.out.println();
    return 1;
    public void destroy() {
    // &#20999;&#26029;
    if (TCPIP_ != null) {
    TCPIP_.disconnect();
    if (TCPIP_.getSocket_() != null) {
    try {
    System.out.println("\ndisconnect:" + TCPIP_.getSocket_().getInetAddress().getHostAddress() + " " + TCPIP_.getSocket_().getPort());
    } catch (Exception e) {
    TCPIP_ = null;
    public boolean conect(int IP) {
    conectFlag = false;
    String address = "192.168.1." + IP;
    System.out.println(address);
    try {
    argIp_ = InetAddress.getByName(address);
    } catch (UnknownHostException e) {
    // xp.init();
    isApplet_ = false;
    start();
    return (conectFlag);
    public void send(String command, int value, int sendData[][], int i) {
    int j = 0;
    Integer value_ = new Integer(value);
    byte values = value_.byteValue();
    Integer progNum = new Integer(i);
    byte progNums = progNum.byteValue();
    try {
    TCPIP_.send(command, values, progNums);
    for (j = 1; j <= i; j++) {
    Integer time = new Integer(sendData[j][0]);
    byte times = time.byteValue();
    Integer power = new Integer(sendData[j][1]);
    byte powers = power.byteValue();
    TCPIP_.send(times, powers);
    TCPIP_.flush();
    } catch (IOException ex) {
    Logger.getLogger(MainProcessing.class.getName()).log(Level.SEVERE, null, ex);
    public void file(String name) {
    ublic void fileclose(String name, String command, int value, int sendData[][], int i) {
    try {
    fos = new FileOutputStream("" + name + ".csv");
    osw = new OutputStreamWriter(fos, "MS932");
    bw = new BufferedWriter(osw);
    String msg = "" + command + "," + value + "";
    bw.write(msg);
    bw.newLine();
    for (int j = 1; j <= i; j++) {
    msg = "" + j + "," + sendData[i][0] + "," + sendData[i][1];
    bw.write(msg);
    bw.newLine();
    bw.close();
    } catch (IOException ex) {
    Logger.getLogger(MainProcessing.class.getName()).log(Level.SEVERE, null, ex);

  • Cant run program using modules in Netbeans

    Hi all,
    I wrote a program using netbeans modules and I can't run it,
    Does anyone knows why?
    I even tried to run it using CLI commands by moving to the directory where the jar file located and write the command:
    java -jar <file package> but I got the following error :
    Execption in thread "main" java.lang.NoClassDeFoundError: /org/jdesktop/layout/GroupLayoutGroup.
    Can someone please help me with this issue?

    no clue???????????

  • How to compile a simple "Hello World" program in Java by using Netbeans

    Hi all, I am very new to java programming arena. i am trying to learn the most demanding language for the time being. To program, i always use IDE's as it makes programming experience much easier by underline the syntax errors or sometimes showing codehint. However, I am facing some problem when i use Netbeabs to compile a simple "Hello world" program. my problem is whenever i write the code and press compile button, netbeans says "main class not found". Consequently,i am becoming frustated. So, i am here in this forum to get some kind help on How i can compile java programs in Netbeans. Please help me out, otherwise i may lose my enthusiasm in Java. please help me, i m stuck

    Go to http://www.netbeans.org/
    You should find tutorials there.

  • I have macbook pro 2012. I 'm using netbeans 7.2 for using programming. It took about 700mb when I use this application.

    I have macbook pro 2012 4gb ram. I 'm using netbeans 7.2 for using programming. It took about 700mb.

    I'm runing out of memeory when I use other applicaiton such as safari with netbens and inactive memory not clearing when not enough memory for other application.Why is this happing? Does netbens application leak memory?

  • How to execute Java programs using Cygwin?

    Ok, so I've installed Cygwin and Netbeans programs. I wrote my program on Netbeans, then tried to use the command javac with Cygwin to compile the main .java file. What next? How do I run the actual program in the Cygwin window?
    Thanks!

    jverd wrote:
    sharkura wrote:
    I thought there was a "native cygwin" version of java available that would, e.g., accept paths like /mnt/c, handle the colon classpath separator, etc. I could be mistaken though. I know there are versions like that for other tools, like perforce and subversion.I'm not sure about a native cygwin port of java, but I use the reference compiler every day, and it handles / just fine (because the bash shell correctly translates it). Are you talking about the file separator? Because that would work fine anyway. Or are you talking about /mnt/c instead of C:? If the latter, I don't recall about Java specifically, but I know I have had problems in both directions in cygwin. For instance, tar can't handle C:, but some existing Windows tools can't handle /mnt/c.
    Ahh, I misunderstood what you were saying. I was talking about a path separator (\ in windows, / in cygwin). The default mount points for drives is, for the version we are using, /cygdrive/c, and that is handled just fine.
    However, it does not handle a colon as a classpath separator if you specify the classpath in the java command. This typically means that the classpath, it written out of the command line, must be "" wrapped (if more than one classpath element exists ... this prevents the bash shell from attempting to split the command at the ;) and must use ; as the path element separator.
    I suppose you could specify the classpath like so, path/element/dir1\;path/element/dir2\;path/element/jar1.jar, without "".Doesn't really matter to me as I use ant to start all my non-trivial programs.As do I. I still write test drivers, and sometimes use nonstandard (wrt our project) classpaths.
    {?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Client/Server in one program (using multiple threads)?

    Is there some examples out there of how to use a client and server in a single program using separate threads? Also, is it possible to start a third thread to control the packets, such as drop a random or specified number of packets (or match on specific data in a packet)?

    Just trying to have a client send udp packets to a server (all on the same machine running from the same program) and want to be able to drop packets coming from the client side to the server side.
    E.g.,
    Here's an example that I found here: http://compnet.epfl.ch/tps/tp5.html
    import java.io.<strong>;
    import java.net.</strong>;
    import java.util.<strong>;
    /</strong>
    * Server to process ping requests over UDP.
    public class PingServer {
         private static double lossRate = 0.3;
         private static int averageDelay = 100; // milliseconds
         private static int port;
         private static DatagramSocket socket;
         public static void main(String[] args) {
              // Get command line arguments.
              try {
                   if (args.length == 0) {
                        throw new Exception("Mandatory parameter missing");
                   port = Integer.parseInt(args[0]);
                   if (args.length > 1) {
                        lossRate = Double.parseDouble(args[1]);
                   if (args.length > 2) {
                        averageDelay = Integer.parseInt(args[2]);
              } catch (Exception e) {
                   System.out.println("UDP Ping Server");
                   System.out.println("Usage: java PingServer port [loss rate] [average delay in miliseconds]");
                   return;
              // Create random number generator for use in simulating
              // packet loss and network delay.
              Random random = new Random();
              // Create a datagram socket for receiving and sending UDP packets
              // through the port specified on the command line.
              try {
                   socket = new DatagramSocket(port);
                   System.out.println("UDP PingSever awaiting echo requests");
              } catch (SocketException e) {
                   System.out.println("Failed to create a socket");
                   System.out.println(e);
                   return;
              // Processing loop.
              while (true) {
                   // Create a datagram packet to hold incoming UDP packet.
                   DatagramPacket request = new DatagramPacket(new byte[1024], 1024);
                   // Block until the host receives a UDP packet.
                   try {
                        socket.receive(request);
                   } catch (IOException e) {
                        System.out.println("Error receiving from socket");
                        System.out.println(e);
                        break;
                   // Print the received data.
                   printData(request);
                   // Decide whether to reply, or simulate packet loss.
                   if (random.nextDouble() < lossRate) {
                        System.out.println("   Reply not sent.");
                        continue;
                   // Simulate network delay.
                   try {
                        Thread.sleep((int) (random.nextDouble() * 2 * averageDelay));
                   } catch (InterruptedException e) {}; // Ignore early awakenings.
                   // Send reply.
                   InetAddress clientHost = request.getAddress();
                   int clientPort = request.getPort();
                   byte[] buf = request.getData();
                   DatagramPacket reply = new DatagramPacket(buf, buf.length,
                             clientHost, clientPort);
                   try {
                        socket.send(reply);
                   } catch (IOException e) {
                        System.out.println("Error sending to a socket");
                        System.out.println(e);
                        break;
                   System.out.println("   Reply sent.");
          * Print ping data to the standard output stream.
         private static void printData(DatagramPacket request) {
              // Obtain references to the packet's array of bytes.
              byte[] buf = request.getData();
              // Wrap the bytes in a byte array input stream,
              // so that you can read the data as a stream of bytes.
              ByteArrayInputStream bais = new ByteArrayInputStream(buf);
              // Wrap the byte array output stream in an input stream reader,
              // so you can read the data as a stream of characters.
              InputStreamReader isr = new InputStreamReader(bais);
              // Wrap the input stream reader in a buffered reader,
              // so you can read the character data a line at a time.
              // (A line is a sequence of chars terminated by any combination of \r
              // and \n.)
              BufferedReader br = new BufferedReader(isr);
              // We will display the first line of the data.
              String line = "";
              try {
                   line = br.readLine();
              } catch (IOException e) {
              // Print host address and data received from it.
              System.out.println("Received echo request from "
                        + request.getAddress().getHostAddress() + ": " + line);
    }I'm looking to do the "processing loop" in a separate thread, but I'd also like to do the client in a separate thread
    So you're saying, just put the client code in a separate class and start the thread and that's it? As far as the packet rate loss thread, is this possible to do in another thread?

  • Problem with JFileChooser when run using Netbeans

    I just want to state that I have NO problem writing the code that brings up this component. My problem is what happens when the JFileChooser component is loaded. My environment is Windows Vista, Java SE 1.6.0. -> Netbeans IDE 5.0. The code I use is as follows:
    public RegexParser()
    JFileChooser openfile = new JFileChooser();
    openfile.showOpenDialog(RegexParser.this);
    int returnVal = openfile.showOpenDialog(RegexParser.this);
    if (returnVal == JFileChooser.APPROVE_OPTION)
    //This code gets the path of the file and uses as a parameter to parse data.
    filename = openfile.getSelectedFile().getPath();
    openfile.setVisible(false);
    ParseData(filename);
    The problem is when I try to select an option from the combobox labeled "Look In:" Every directory I select which is not the root of the drive will display NO FILES even though there are files in that directory.
    Notice: I have also run the same code using the cmd.exe and it works fine. I have also looked at: http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html but have found nothing that has helped me.
    Can someone explain what is the problem? Is this a known bug in Netbeans? Is there any code that can be used as a workaround?

    Yes I copied the code to my machine and run it. The example program had problems when I executed using netbeans it had the problem.
    When I executed using Command Prompt there where no problems.

  • Web Service tutorial using NetBeans 5.5 fails on OS X Tiger

    I have tried doing this tutorial using NetBeans 5.5 with the Enterprise Pack and Visual Web extensions installed. I am able to get it to run fine on my WinXP machine configured with the same NetBeans 5.5 stuff as the Mac. I have tried it several times always with the same result. Any insight that you can provide will be greatly appreciated.
    The tutorial is located: http://www.netbeans.org/kb/55/websvc-jax-ws.html
    Below is what is being returned in the Output window upon Run:
    init:
    deps-module-jar:
    deps-ear-jar:
    deps-jar:
    Created dir: /Users/bob/Programming/CalculatorWSApplication/build/web/WEB-INF/classes
    Created dir: /Users/bob/Programming/CalculatorWSApplication/build/web/META-INF
    Copying 1 file to /Users/bob/Programming/CalculatorWSApplication/build/web/META-INF
    Copying 4 files to /Users/bob/Programming/CalculatorWSApplication/build/web
    library-inclusion-in-archive:
    Copying 1 file to /Users/bob/Programming/CalculatorWSApplication/build/web/WEB-INF/lib
    Copying 1 file to /Users/bob/Programming/CalculatorWSApplication/build/web/WEB-INF/lib
    Copying 1 file to /Users/bob/Programming/CalculatorWSApplication/build/web/WEB-INF/lib
    Copying 1 file to /Users/bob/Programming/CalculatorWSApplication/build/web/WEB-INF/lib
    Copying 1 file to /Users/bob/Programming/CalculatorWSApplication/build/web/WEB-INF/lib
    Copying 1 file to /Users/bob/Programming/CalculatorWSApplication/build/web/WEB-INF/lib
    Copying 1 file to /Users/bob/Programming/CalculatorWSApplication/build/web/WEB-INF/lib
    Copying 1 file to /Users/bob/Programming/CalculatorWSApplication/build/web/WEB-INF/lib
    Copying 1 file to /Users/bob/Programming/CalculatorWSApplication/build/web/WEB-INF/lib
    Copying 1 file to /Users/bob/Programming/CalculatorWSApplication/build/web/WEB-INF/lib
    Copying 1 file to /Users/bob/Programming/CalculatorWSApplication/build/web/WEB-INF/lib
    Copying 1 file to /Users/bob/Programming/CalculatorWSApplication/build/web/WEB-INF/lib
    Copying 1 file to /Users/bob/Programming/CalculatorWSApplication/build/web/WEB-INF/lib
    Copying 1 file to /Users/bob/Programming/CalculatorWSApplication/build/web/WEB-INF/lib
    Copying 1 file to /Users/bob/Programming/CalculatorWSApplication/build/web/WEB-INF/lib
    library-inclusion-in-manifest:
    Compiling 1 source file to /Users/bob/Programming/CalculatorWSApplication/build/web/WEB-INF/classes
    wsgen-init-nonJSR109:
    Created dir: /Users/bob/Programming/CalculatorWSApplication/build/generated/wsgen/service
    wsgen-CalculatorWS-nonJSR109:
    Problem encountered during annotation processing;
    see stacktrace below for more information.
    java.lang.NoSuchMethodError: com.sun.codemodel.JCodeModel._class(Ljava/lang/String;Lcom/sun/codemodel/ClassType;)Lcom/sun/codemodel/JDefinedClass;
    at com.sun.tools.ws.processor.modeler.annotation.WebServiceWrapperGenerator.getCMClass(WebServiceWrapperGenerator.java:446)
    at com.sun.tools.ws.processor.modeler.annotation.WebServiceWrapperGenerator.generateWrappers(WebServiceWrapperGenerator.java:256)
    at com.sun.tools.ws.processor.modeler.annotation.WebServiceWrapperGenerator.processMethod(WebServiceWrapperGenerator.java:141)
    at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.visitMethodDeclaration(WebServiceVisitor.java:468)
    at com.sun.tools.apt.mirror.declaration.MethodDeclarationImpl.accept(MethodDeclarationImpl.java:41)
    at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.processMethods(WebServiceVisitor.java:406)
    at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.postProcessWebService(WebServiceVisitor.java:361)
    at com.sun.tools.ws.processor.modeler.annotation.WebServiceWrapperGenerator.postProcessWebService(WebServiceWrapperGenerator.java:115)
    at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.visitClassDeclaration(WebServiceVisitor.java:167)
    at com.sun.tools.apt.mirror.declaration.ClassDeclarationImpl.accept(ClassDeclarationImpl.java:95)
    at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.buildModel(WebServiceAP.java:345)
    at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.process(WebServiceAP.java:230)
    at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(AnnotationProcessors.java:60)
    at com.sun.tools.apt.comp.Apt.main(Apt.java:454)
    at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:448)
    at com.sun.tools.apt.main.Main.compile(Main.java:1075)
    at com.sun.tools.apt.main.Main.compile(Main.java:938)
    at com.sun.tools.apt.Main.processing(Main.java:95)
    at com.sun.tools.apt.Main.process(Main.java:85)
    at com.sun.tools.apt.Main.process(Main.java:67)
    at com.sun.tools.ws.wscompile.CompileTool.buildModel(CompileTool.java:603)
    at com.sun.tools.ws.wscompile.CompileTool.run(CompileTool.java:536)
    at com.sun.tools.ws.util.ToolBase.run(ToolBase.java:54)
    at com.sun.tools.ws.ant.WsGen.execute(WsGen.java:457)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
    at org.apache.tools.ant.Task.perform(Task.java:364)
    at org.apache.tools.ant.Target.execute(Target.java:341)
    at org.apache.tools.ant.Target.performTasks(Target.java:369)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
    at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:240)
    at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:293)
    at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:131)
    error: compilation failed, errors should have been reported
    wsgen-generate-nonJSR109:
    compile:
    compile-jsps:
    Created dir: /Users/bob/Programming/CalculatorWSApplication/dist
    Building jar: /Users/bob/Programming/CalculatorWSApplication/dist/CalculatorWSApplication.war
    do-dist:
    dist:
    Incrementally deploying http://localhost:8084/CalculatorWSApplication
    Completed incremental distribution of http://localhost:8084/CalculatorWSApplication
    Incrementally redeploying http://localhost:8084/CalculatorWSApplication
    deploy?config=file:/tmp/context18085.xml&path=/CalculatorWSApplication
    OK - Deployed application at context path /CalculatorWSApplication
    run-deploy:
    Browsing: http://localhost:8084/CalculatorWSApplication/CalculatorWS?Tester
    run-display-browser:
    run:
    BUILD SUCCESSFUL (total time: 1 second)

    This problem gets solved if you do NOT provide the Java path to the installer.
    e.g.
    if you have Java in /usr//bin/java
    make sure your PATH does not have /usr/bin....
    so basically which java throw error....Then provide the JRE PATH in oraparam.ini for the installer to start ...
    Give it a try...
    Karurkar

  • Program using Xalan 1.10 doesn't compile

    Hi all,
    I have to port some server code from Windows to Solaris. Normaly this works fine, but now I have a problem using Xalan 1.10.
    Platfrom: SunOS sun4 5.8 Generic_108528-24 sun4u sparc SUNW,Ultra-80
    Compiler: Sun C++ 5.7 Patch 117830-07 2006/03/15
    By including a Xalan header and compile it with "CC -I/opt/xalan/src -I/opt/xerces/src -library=stlport4 xalan.cpp" I got the errorlist below.
    Without stlport4 it compiles. I have to use this library, because I am using boost and I have had only success building the boost stuff with stlport4.
    Do I have to modify the Xalan header? Has anybody some suggestions?
    Thanks for your help
    Arno
    Here is the example code:
    #include <xalanc/XalanTransformer/XalanTransformer.hpp>
    int main ()
    return 0;
    Here are the error messages from the compiler:
    "/opt/xalan/src/xalanc/Include/XalanVector.hpp", line 102: Error: Too many arguments for template std::reverse_iterator<xalanc_1_10::Type*, std::random_access_iterator_tag, xalanc_1_10::Type>.
    "/opt/xalan/src/xalanc/Include/XalanVector.hpp", line 1101: Where: While specializing "xalanc_1_10::XalanVector<xalanc_1_10::Type, xalanc_1_10::ConstructionTraits>".
    "/opt/xalan/src/xalanc/Include/XalanVector.hpp", line 1101: Where: Specialized in non-template code.
    "/opt/xalan/src/xalanc/Include/XalanVector.hpp", line 106: Error: Too many arguments for template std::reverse_iterator<const xalanc_1_10::Type*, std::random_access_iterator_tag, const xalanc_1_10::Type>.
    "/opt/xalan/src/xalanc/Include/XalanVector.hpp", line 1101: Where: While specializing "xalanc_1_10::XalanVector<xalanc_1_10::Type, xalanc_1_10::ConstructionTraits>".
    "/opt/xalan/src/xalanc/Include/XalanVector.hpp", line 1101: Where: Specialized in non-template code.
    "/opt/xalan/src/xalanc/Include/XalanDeque.hpp", line 186: Error: Too many arguments for template std::reverse_iterator<xalanc_1_10::XalanDequeIterator<xalanc_1_10::XalanDequeIteratorTraits<xalanc_1_10::Value>, xalanc_1_10::XalanDeque<xalanc_1_10::Type, xalanc_1_10::ConstructionTraits>>, std::random_access_iterator_tag, xalanc_1_10::Type>.
    "/opt/xalan/src/xalanc/XPath/XalanQName.hpp", line 73: Where: While specializing "xalanc_1_10::XalanDeque<xalanc_1_10::Type, xalanc_1_10::ConstructionTraits>".
    "/opt/xalan/src/xalanc/XPath/XalanQName.hpp", line 73: Where: Specialized in non-template code.
    "/opt/xalan/src/xalanc/Include/XalanDeque.hpp", line 190: Error: Too many arguments for template std::reverse_iterator<xalanc_1_10::XalanDequeIterator<xalanc_1_10::XalanDequeConstIteratorTraits<xalanc_1_10::Value>, xalanc_1_10::XalanDeque<xalanc_1_10::Type, xalanc_1_10::ConstructionTraits>>, std::random_access_iterator_tag, const xalanc_1_10::Type>.
    "/opt/xalan/src/xalanc/XPath/XalanQName.hpp", line 73: Where: While specializing "xalanc_1_10::XalanDeque<xalanc_1_10::Type, xalanc_1_10::ConstructionTraits>".
    "/opt/xalan/src/xalanc/XPath/XalanQName.hpp", line 73: Where: Specialized in non-template code.
    4 Error(s) detected.

    On Solaris, Posix threads are implemented on top of native threads; the interfaces are different. There are no conflicts between the two libraries or their interfaces. You can mix Posix and native thread usage.
    libCstd and STLport are different implementations of the same interface. The size and layout of the standard types are different. The names of the standard functions are the same, but the definitions of those functions are different.
    Suppose both parts of the program use the standard string class. One part was compiled for use with libCstd, and creates the libCstd version of a string object. If that object gets passed to the part of the program compiled for use with STLport, it will have a different idea of how the class is defined.
    If you link both libCstd and libstdlport to the program, all the standard objects (like cin and cout) and functions (class members and free functions) will have the same names. You wil pick up the version from whichever library is linked first. Calling libCstd function on an STLport object won't work, and neither will the reverse.
    Finally, recall that much of the standard library consists of inline functions. The bodies of those functions are embeded in the .o files of your application code. The application code will therefore depend on a particular layout of standard class objects; the layout is different in the two libraries.
    We have not made a serious effort to compile BOOST using libCstd -- much of BOOST depends on too many missing features. Some suggestions:
    1. You can try experimenting with BOOST configuration macros and see if you can get the code to compile.
    2. You could wirte your own version of the BOOST components you are using, removing dependencies on features that are not in libCstd.
    3. You could ask the 3rd-party library supplies to provide a version compiled with -library=stlport.

  • How can i browse FP 2000 via serial port same use Ethernet port(RJ 45)?

    I am a new user for  labview.I develope my program with FP 2000 but I have some problem
      1 How can i browse FP 2000 via serial port same use Ethernet port(RJ 45)? if it can Tell me please.
      2 If  I use GSM/GPRS modem via FP 2000 rs 232 port (I under stand how to send AT command) and leave it stand alone
         Can I dial modem and browse file in FP 2000 same as use Ethernetport?
    Someone please help me.Thank you very much.

    Hi!
        First, I can say that your project involves many things, I cannot describe all features in the forum, and I'm not used with GPRS modems (my modems are base band serial modems...).
        Anyway, I would say that in your project you should proceed like this:
          1) Configure your FP 2000 module via MAX and ethernet connection;
          2) Download an embedded application to your module (build in LabView Real-Time)
          3) In your application, you should build a kind of serial port manager, and by the means of serial port you send/receive commands from PC.
        The commands from PC can include "Tell me the about the FP 2000 file system ", or "switch on line X", or anything you need.
       I think it would be difficult to use Internet exp, because you use IE with TCP/IP, and TCP/IP is over ethernet.
       I know that for Windows you can find some wrappers that make you "see" the serial port as an ethernet, but these wrapper do not exist under filed Point, and you shoul build one yourself!!!(and that's not easy).
        For example, to browse your files, you should build a VI that searches through your file system, and reports, via serial, the files present in a directory (it's an example....).
        About communication between GPRS modems and FP2000, I know nothing.  I suppose that these modems accept serial inputs, so you'll have to configure your serial port on FP 2000 with the correct baud rate, parity, and so on..... and you send your data to the modem.  The modem will transfer data in its way, no matter on how it does.
        To send data to your modem you shoud take a look to some Serial communication examples.  What I suggest you, first, is to connect the serial port of FP2000 to a PC, and test communication between PC and FP2000, without modems. Just direct cable connection!  If you're able to do this, insertion of modems is the next step, and should be quite easy.  If you're not able to make the PC receive strings of data from FP2000, over  RS232, adding modems is a further complication, and you won't come out of this mess!
       So, what I say, is just build, for now, a simple embedded application for FP2000, that, using RS232, sends data to a PC (you should see data sent with use of Hyper terminal).
        To build this application, use Instrument I/O --> VISA commands (VISA open, VISA write, and Property node should be enough, for now).
       Please, let me know if this helps......
        Have a nice (programming) day!
    graziano

  • Connect to MS Access using NetBeans, data source name not found!

    Hi
    NetBeans IDE 7.3 and OS was Windows 7 (64-bit )
    When I run my program by NetBeans, it complain about the following errors.
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    In fact, the MS Access file had exist the specify path, I can run the jar file (not in IDE environment) and connect to MS Access DB successfully.
    And I had search from network, and found it said "the ODBC source was run by different server", one was C:\Windows\SysWOW64\odbcad32.exe for 32-bit and c:\windows\system32\odbcad32.exe for 64-bit.
    So the question is, why IDE cannot connect to MS Access DB, How to set NetBeans IDE to make it connectable to 32 bits or 64 bits ODBC, like the program run without IDE?
    Thanks!

    user13005878 wrote:
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specifiedThat reads like "your datasource configuration is not good, fix it"
    And I had search from network, and found it said "the ODBC source was run by different server", one was C:\Windows\SysWOW64\odbcad32.exe for 32-bit and c:\windows\system32\odbcad32.exe for 64-bit. It would make a whole lot of sense if that was the other way around, don't you think? SysWOW64 for 64 bits and system32 for 32 bits.
    So the question is, why IDE cannot connect to MS Access DBBecause something is wrong
    How to set NetBeans IDE to make it connectable to 32 bits or 64 bits ODBC, like the program run without IDE?By setting the correct connection configuration properties.
    I'm not 100% positive, but I believe that doing ODBC connections from a 64 bits environment is not actually supported in Java. You may be outraged by that - in Java 8 the ODBC-JDBC bridge is going to be completely dropped, no more connecting to Access from Java without third party libraries (which tend to be commercial). In any case for now try to use a 32 bits Java runtime if you're using a 64 bits one.

  • How to set JTable cell editable/non-editable dynamically using NetBean?

    I am using NetBean 6.5, create a database desktop application, I using the persistence entity manager to bind my JTable with database.
    Now, I want to set practicular cells which are enable and disable, I tried to create my own table model and override the isEditable() method, which it seems didn't work. I guessed the problem is the persistence connection between my Table and database.
    How can I solve it? Any example? I just googled the web and can't find example which use netbean combined with database. I know that a single JTable would work when creating your own model.
    thx.

    I know what coding i did, Yes u r right but im new to GUI programming only,
    That's why i posted it to forums, I gone through the Control Flow Statements link what u have given.
    U didnt get my question at all.
    Again the problem im facing is the table is already displayed with 2nd column uneditable.
    When some Action done on table, i need to make 2nd column editable at run time.
    Thanks if u provide me the solution instead of deciding what type of programmer im.

  • Do any of you know how to use NetBeans?

    I downloaded NetBeans 4.0 and tried to start a new project and entered my Hello World code in the code window but it said something like "No main class set". I was wondering if someone could post some step by step instructions of how to create a simple program using the IDE or is it not intended for beginners like me?

    I did look through that info and it did not appear to tell me what I wanted. However I opened up my book tonight and in the back it had a chapter on using NetBeans. Their version is slightly older but kind of similar so I followed their instructions and I think I got it to work, although it still said "No main class set." After that though it did display the output to the console window.
    I would like to ask why there are differences in these IDE's. For example in Eclipse I will type:
    public class Welcome {
    public static void main(String args[ ])
    System.out.println("Welcome to Java!");
    And then I will click Run and it ouputs "Welcome to Java!".
    But in NetBeans I will see a bit more code like this:
    public class Welcome {
    /** Creates a new instance of Welcome */
    public Welcome() {
    * @param args the command line arguments
    public static void main(String[] args) {
    // TODO code application logic here
    System.out.println("Welcome to Java!");
    So NetBeans is adding public Welcome( ). Which I think is a constructor?
    I'm wondering why one IDE won't show that yet another IDE will? And I don't think the books tell you to type that in either. I'm wondering is that important to know what it is and what it does or should I not worry about it? Actually I'd like to know what every piece does, it makes me feel better knowing.

Maybe you are looking for

  • Burn issues

    IDvd finds errors in the burn of my dvd everytime. I redid the entire movie and layout many times with no help. This is especially wierd because it only does it with this one file. Help.

  • PLL in Forms 4.5

    Hi I need to add a new program unit( procedure in the PLL) which will be used by only some of the forms. Do I need to compile only the forms which will be calling the new program unit or do I need to compile all the forms once again. One more point t

  • How to make parent node JCheckbox

    How can I make the parent node in http://www.java2s.com/Code/Java/Swing-JFC/CheckBoxNodeTreeSample.htm to a checkbox. Any help is greatly appreciated. Regards, Anees

  • Query for Finding the Daily Cumulative Production Total

    Hi Experts, I want Query based Report for finding Daily Cumulative i.e Running Production Total Suppose Yesterdays Production for Item A0001 is 20 and Todays Prodction is 20 then it will show 50 but it shout be datewise selection. Warm Regards, Sandi

  • Help ... my pc won't turn on!

    Hey folks! I'll start of with the system specs so you'll have an idea of what I'm going to be talking about: AMD Athlon64 3000+ MSI K8N Neo Platinum Corsair CMX-512 PC3200 WD 160gb SATA MSI 5900xt Antec SmartBlue 350w I purchased the parts for the sy