Hi,

I have this program that runs with eclipse fine,
but it dosn't run with the bat file.
The Exception is NoClassDefFoundError: javax/comm/SerialPort/EventLstener.

another class in the package runs good with the bat file

The bat file is
[code]
java newGUIandSerial.SimpleRead
pause
[\code]

The code is:

[code]

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

public class SimpleRead implements Runnable, SerialPortEventListener {
static CommPortIdentifier portId;
static Enumeration portList;

InputStream inputStream;
SerialPort serialPort;
Thread readThread;

public static void main(String[] args) {
portList = CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements()) {
portId = (CommPortIdentifier) portList.nextElement();
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
SimpleRead reader = new SimpleRead();
// if (portId.getName().equals("COM1")) {
if (portId.getName().equals("/dev/term/a")) {
reader = new SimpleRead();
}
}
}
}

public SimpleRead() {
try {
serialPort = (SerialPort) portId.open("SimpleReadApp", 2000);
} catch (PortInUseException e) {}
try {
inputStream = serialPort.getInputStream();
} catch (IOException e) {}
try {
serialPort.addEventListener(this);
} catch (TooManyListenersException e) {}
serialPort.notifyOnDataAvailable(true);
try {
serialPort.setSerialPortParams(9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
} catch (UnsupportedCommOperationException e) {}
readThread = new Thread(this);
readThread.start();
}

public void run() {
try {
Thread.sleep(20000);
} catch (InterruptedException e) {}
}

public void serialEvent(SerialPortEvent event) {
switch(event.getEventType()) {
case SerialPortEvent.DATA_AVAILABLE:
byte[] readBuffer = new byte[20];
int numBytes;
try {
numBytes = inputStream.read(readBuffer);
System.out.println(numBytes);
if (numBytes == 14){
System.out.println("שיחקתי אותה");
}
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

try {
// if (inputStream.available() > 0)
// System.out.print(new String(readBuffer));
while (inputStream.available() > 0) {
numBytes = inputStream.read(readBuffer);
}
// System.out.print(new String(readBuffer));
} catch (IOException e) {}
break;
}
}
}

[\code]

thanks