Any Idea. Dealing with javax.comm ... UnsupportedCommOperationException ?

Hi... I would really appreciate if someone can help me out fugure this problem , cause this haulted the entire project i'm working on... I am creating a serial connection between my computer and a server located on a different machine... Both are connected via a serial cord... Now my program runs perfect when i use my compiler(code warrior 6.0) to run the application. Later i changed the java output type in the 'target setting panel' from a jar file to an executable file, this creates a Zip format file and an exe format file of the project. When i double click on the exe file to start my application this is what the console prints out

"Exception in thread "main" java.lang.NoClassDefFoundError: javax/comm/UnsupportesCommOperationException.

Now i don't have any error when i compile it using the compiler and the data transfer across the serial port is perfect. Now i'll include the parts of the code that have the serial port specification in them.... I would really appreciate if someone has any suggestions at all..

/CODE/

import javax.comm.*;

import javax.comm.UnsupportedCommOperationException;

import javax.comm.SerialPort;

//In the global definitions

private Enumeration portList;

private CommPortIdentifier portId;

private SerialPort serialPort;

//In the Event handler where the connection is chosen

while(portList.hasMoreElements())

{

portId = (CommPortIdentifier)portList.nextElement();

if(portId.getPortType() == CommPortIdentifier.PORT_SERIAL)

{

if(portId.getName().equals(portName))

{

try

{

serialPort = (SerialPort)portId.open("this",milliSecond);

}

catch(PortInUseException port_ex)

{

JOptionPane.showMessageDialog(null,"The port is in use","Error",JOptionPane.ERROR_MESSAGE);

}

try

{

serialPort.setSerialPortParams(38400,

serialPort.DATABITS_8,

serialPort.STOPBITS_1,

serialPort.PARITY_ODD);

}

catch(UnsupportedCommOperationException comm_ex)

{

JOptionPane.showMessageDialog(null,"Port parameters is unsupported by the driver","Error",JOptionPane.ERROR_MESSAGE);

}

}

}

}

//In the area where the send routine via serial is

public boolean sendSerialMsg(byte[] buffer, byte[] rcvMsg)

{

int count = 0, retryCount = 5;

int DataCounter = buffer[0] & 0x0f;

buffer[DataCounter+2] = checkSum(buffer);

try

{

while(count < retryCount)

{

int bytesRead;

inputSerialStream = serialPort.getInputStream();

outputSerialStream = serialPort.getOutputStream();

outputSerialStream.write(buffer, 0, MinMessageSize + DataCounter);

bytesRead = inputSerialStream.read(rcvMsg, 0, MaxMessageSize);

byte computedCS = checkSum(rcvMsg);

DataCounter = rcvMsg[0] & 0x0f;

if(rcvMsg[ (MinMessageSize + DataCounter) - 1] == computedCS )

{

// check the message, if ACK success, otherwise inc count retry

if(rcvMsg[1]==TallyNak)

{

System.out.println("Not Acknowledged");

}

else

{

return true;

}

}

count++;

}

}

catch(IOException io_ex)

{

JOptionPane.showMessageDialog(this,"No such connection","Error",JOptionPane.ERROR_MESSAGE);

}

return false;

}

/CODE/

Also if lets say the cord is connected to COM1 in the computer as well as the server and i choose COM2, the computer crashes. Is there a way to find out to what COM is the cord connected to ?

[3669 byte] By [geotdw] at [2007-9-26 2:03:21]
# 1
Hi, Please refer this URL. http://www.javaworld.com/javaworld/jw-05-1998/jw-05-javadev_p.htmlThanksBakrudeen
bakrudeen_indts at 2007-6-29 8:46:00 > top of Java-index,Core,Core APIs...
# 2

Hi,

Also please refer this URL for the above errors.

http://lists.dalsemi.com/maillists/tini/2000-December.txt

http://www.jos.org/redist/srcserv1c/javax.comm.UnsupportedCommOperationException.src.html

I hope this will help you.

Thanks

Bakrudeen

bakrudeen_indts at 2007-6-29 8:46:00 > top of Java-index,Core,Core APIs...
# 3

Thanks for the reply. Actually what u sent me was very helpfull in understanding more about serial ports in detail but it still did no really answer my question... It does'nt say how to exactly now which port is the line connected to through the computer. And second, the error i'm getting does'nt stop my program from running perfect when using the compiler, only when i change the application to an exe and then run the exe... Anyway, thanks for u're help....

geotdw at 2007-6-29 8:46:00 > top of Java-index,Core,Core APIs...