SerialConnectionException in SerialDemo

Hi, all.
I have a problem with SerialDemo application. I use gnu.io package instead javax.comm package. SerialDemo can list my COM ports but when I choose Open Port, it's has an exception occurs. It's SerialConnectionException. I don't know why this exception occurs. Please help me.
Thank you.

i have this error when run SerialDemo:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/comm/CommPortIdentifier
at SerialDemo$ConfigurationPanel.listPortChoices(SerialDemo.java:560)
at SerialDemo$ConfigurationPanel.<init>(SerialDemo.java:448)
at SerialDemo.<init>(SerialDemo.java:142)
at SerialDemo.main(SerialDemo.java:89)
My CLASSPATH :
C:\j2me\midp2.0fcs\classes;C:\Benhui_Bluecove;
C:\Benhui_Bluecove\classes;
C:\WTK23\apps\BTGalleryExample\src;
C:\Programmi\UCB\jdk1.4.1_02\j2sdk1.4.1_02\jre\lib\comm.jar;
and i have followed the instructions that are at http://www.benhui.net
These are the instructions :
To get mine to work, I copied the 'comm.jar' and 'javax.comm.properties' files into the following locations:
* <J2SE SDK installation directory>\lib
* <J2SE SDK installation directory>\jre\lib
* <J2SE SDK installation directory>\jre\lib\ext
And copied the 'win32com.dll' into the following locations:
* <J2SE SDK installation directory>\bin
* <J2SE SDK installation directory>\jre\bin
Can someone help me?
Thanks
Dani

Similar Messages

  • Unable to compile "SerialDemo.java", many "cannot find symbols" errors

    I have all the correct files in their respective directory.
    comm.jar in jre\lib\bin,
    javax.comm.properties in jre\lib
    win32com.dll in jre\bin
    I extracted all the whole of SerialDemo into one folder and started compiling from there. But it doesn't work. I keep getting many "cannot find symbol" errors. They are usually referred to by:
    SerialParameters
    SerialConnection
    AlertDialog
    SerialConnectionException
    SerialDemo.java is not edited and was compiled directly. All of my files are in one folder (AlertDialog.java compiles fine and is in the same folder, etc)
    I was wondering what might be the cause of it. I'm currently using a Windows XP Service Pack 2, IBM P3 Laptop. I was reading "http://forum.java.sun.com/thread.jspa?threadID=674514&messageID=3941560"
    And I found out it works fine on Win2k OS. Why is this so? I'm getting the exact same error as he stated on his last post and I tried looking for a solution and decided to turn to you guys. I'd really appreciate some help, if any. Thanks in advance.

    I followed the PlatformSpecific. I realised that I
    added one for JRE when it wasn't required. The
    problem was solved.
    Thank you so much, the both of you. My stupid mistake
    caused quite a bit of havoc. I apologise.No need to apologise; The confusing part is that when you download
    a jre, that's just what your get: a jre, but when you download the jdk
    you not just get the jdk and the jre but you get a second jre with them,
    stored under the jdk directory.
    To the programmer that second jre is useless, it is used internally by
    the jdk tools.
    kind regards,
    Jos

  • Can I use "SerialDemo" or "BlackBox" to read data from hardware device?

    Hi All,
    I want read data comm port which is been connected with hardware device(weight reader).Can I use "SerialDemo" or "BlackBox" sample programs provided with javax.comm package?
    If yes do I need to do any modification in program as per my hardware device?
    Please help
    Thanks in advance to all
    Basavaraj

    You'll need to know what data is being sent from the device, and the example code SHOULD NOT be used.
    It is only to show you HOW to do it.
    Following the example code, build an application that reads from that port. Read the information from the manufacturer's website to get the details about the format of the data sent.

  • Comm API and Exception in SerialDemo

    I was able to compile the SerialDemo source into the application. However, when I run it, it throws an exception at line 560 of SerialDemo$ConfigurationPanel.listPortChoices
    This line deals with enumerating the available ports on a system. The exception is a NoClassDefFound (no such class) error. It is looking for javax.comm.CommPortIdentifier
    I have installed Comm API 2.0 according to the Win32 directions. I once had a prior installation working - at least listing what ports I actually had on the system - but even then the apps were unable to work with them at all.
    Anyone got ideas?

    i have this error when run SerialDemo:
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/comm/CommPortIdentifier
    at SerialDemo$ConfigurationPanel.listPortChoices(SerialDemo.java:560)
    at SerialDemo$ConfigurationPanel.<init>(SerialDemo.java:448)
    at SerialDemo.<init>(SerialDemo.java:142)
    at SerialDemo.main(SerialDemo.java:89)
    My CLASSPATH :
    C:\j2me\midp2.0fcs\classes;C:\Benhui_Bluecove;
    C:\Benhui_Bluecove\classes;
    C:\WTK23\apps\BTGalleryExample\src;
    C:\Programmi\UCB\jdk1.4.1_02\j2sdk1.4.1_02\jre\lib\comm.jar;
    and i have followed the instructions that are at http://www.benhui.net
    These are the instructions :
    To get mine to work, I copied the 'comm.jar' and 'javax.comm.properties' files into the following locations:
    * <J2SE SDK installation directory>\lib
    * <J2SE SDK installation directory>\jre\lib
    * <J2SE SDK installation directory>\jre\lib\ext
    And copied the 'win32com.dll' into the following locations:
    * <J2SE SDK installation directory>\bin
    * <J2SE SDK installation directory>\jre\bin
    Can someone help me?
    Thanks
    Dani

  • Comm API problems RS232 SerialDemo

    Hello,
    before you ask: yes, i have read a lot of postings concerning this topic.
    However, my problem is different than the common Comm API problems.
    Win2000, JDK 1.5.2, Comm API 2.0.
    The SerialDemo compiles (wow), shows the correct COM Ports (1) (this has been a major problem in a lot of postings), and works without exceptions. Great, but i dont get any serialEvent when i send something from my device on COM1 (a balance).
    I know the RS232 parameters (1200,7 data bits, 1 stop bit, parity odd), and i connected this device without problems to a Delphi application.
    Cable is the same and the correct one. The device sends with CRLF (ASCII 13 and 10) at the end of each string.
    I tried SimpleRead.java too, but here the same: no serialEvent has been triggered when the device sends its data.
    Any ideas?
    Oliver

    Hi
    sorry, it does work now :)
    It was the device itself which was causing the problem.
    But i really wasnt expecting this, because the day before the device (a balance) worked without any problems. Its quite funny that the balance stopped working just the day i started with the Java communication :)
    thanks
    Oliver

  • SerialDemo

    Hi,
    Does any body try to run the sample application SerialDemo in Javacomm API? I am trying to write something at the top text area and the text should at the bottom text area if this demo perfectly write and read. I set some debuging, it looks like its writing OK but its not reading. Do I need to use a null modem cable to make a two way communication or I should be able to do it without it? Please somebody...

    Yes.U need to use to use a null model cable between com1 and com2.
    Step 1:
    Run the SerialDemo application from command prompt.Open com1 port.
    Step 2:
    Run the SerialDemo application from another command prompt.Open com2 port.
    Start typing in either of the window.It works fine.

  • Got what it takes to get me going?

    Hi...
    As a newbie I need some help.
    I've been fighting with Borland Foundation 2005 to compile 2 samples from sun namely SerialDemo and JavaSoundDemo. I appear to get a blast of errors from the compiler.
    I can run the bytecode that is supplied and the code appears to execute. However, when compiling I get a load of erros.
    When compiling the SERIALDEMO sample it fails...
    Here's the compiler errors in full:
    "PortRequestedDialog.java": cannot find symbol; symbol  : class SerialDemo, location: class PortRequestedDialog at line 45, column 13
    "PortRequestedDialog.java": cannot find symbol; symbol  : class SerialDemo, location: class PortRequestedDialog at line 53, column 32
    "PortRequestedDialog.java": operator + cannot be applied to SerialDemo.getLocationOnScreen.x,int at line 81, column 50
    "PortRequestedDialog.java": operator + cannot be applied to SerialDemo.getLocationOnScreen.y,int at line 82, column 50
    "PortRequestedDialog.java": cannot find symbol; symbol  : method setLocation(<nulltype>,<nulltype>), location: class PortRequestedDialog at line 81, column 9
    "SerialConnection.java": cannot find symbol; symbol  : class SerialDemo, location: class SerialConnection at line 45, column 13
    "SerialConnection.java": cannot find symbol; symbol  : class SerialParameters, location: class SerialConnection at line 49, column 13
    "SerialConnection.java": cannot find symbol; symbol  : class SerialDemo, location: class SerialConnection at line 70, column 29
    "SerialConnection.java": cannot find symbol; symbol  : class SerialParameters, location: class SerialConnection at line 71, column 29
    "SerialConnection.java": cannot find symbol; symbol  : class SerialConnectionException, location: class SerialConnection at line 90, column 40
    "SerialConnection.java": cannot find symbol; symbol  : class SerialConnectionException, location: class SerialConnection at line 167, column 50
    "SerialConnection.java": cannot find symbol; symbol  : class SerialConnectionException, location: class SerialConnection at line 97, column 23
    "SerialConnection.java": cannot find symbol; symbol  : class SerialConnectionException, location: class SerialConnection at line 107, column 23
    "SerialConnection.java": cannot find symbol; symbol  : class SerialConnectionException, location: class SerialConnection at line 114, column 18
    "SerialConnection.java": cannot find symbol; symbol  : class SerialConnectionException, location: class SerialConnection at line 126, column 23
    "SerialConnection.java": cannot find symbol; symbol  : class SerialConnectionException, location: class SerialConnection at line 140, column 23
    "SerialConnection.java": cannot find symbol; symbol  : class SerialConnectionException, location: class SerialConnection at line 188, column 23
    "SerialConnection.java": setFlowControlMode(int) in javax.comm.SerialPort cannot be applied to (boolean) at line 193, column 19
    "SerialConnection.java": cannot find symbol; symbol  : class SerialConnectionException, location: class SerialConnection at line 196, column 23
    "SerialConnection.java": cannot find symbol; symbol  : class PortRequestedDialog, location: class SerialConnection at line 302, column 13
    "SerialConnection.java": cannot find symbol; symbol  : class PortRequestedDialog, location: class SerialConnection at line 302, column 43
    "SerialDemo.java": cannot find symbol; symbol  : class SerialParameters, location: class SerialDemo at line 71, column 13
    "SerialDemo.java": cannot find symbol; symbol  : class SerialConnection, location: class SerialDemo at line 72, column 13
    "SerialDemo.java": cannot find symbol; symbol  : class SerialParameters, location: class SerialDemo at line 104, column 26
    "SerialDemo.java": cannot find symbol; symbol  : class SerialConnection, location: class SerialDemo at line 178, column 26
    "SerialDemo.java": cannot find symbol; symbol  : class AlertDialog, location: class SerialDemo at line 206, column 17
    "SerialDemo.java": cannot find symbol; symbol  : class AlertDialog, location: class SerialDemo at line 206, column 38
    "SerialDemo.java": cannot find symbol; symbol  : class SerialConnectionException, location: class SerialDemo at line 261, column 22
    "SerialDemo.java": cannot find symbol; symbol  : class AlertDialog, location: class SerialDemo at line 262, column 17
    "SerialDemo.java": cannot find symbol; symbol  : class AlertDialog, location: class SerialDemo at line 262, column 38
    "SerialDemo.java": [deprecation] save(java.io.OutputStream,java.lang.String) in java.util.Properties has been deprecated at line 341, column 18
    "SerialDemo.java": cannot find symbol; symbol  : class AlertDialog, location: class SerialDemo.ConfigurationPanel at line 585, column 21
    "SerialDemo.java": cannot find symbol; symbol  : class AlertDialog, location: class SerialDemo.ConfigurationPanel at line 585, column 42
    "SerialDemo.java": cannot find symbol; symbol  : class SerialConnectionException, location: class SerialDemo.ConfigurationPanel at line 599, column 26
    "SerialDemo.java": cannot find symbol; symbol  : class AlertDialog, location: class SerialDemo.ConfigurationPanel at line 602, column 21
    "SerialDemo.java": cannot find symbol; symbol  : class AlertDialog, location: class SerialDemo.ConfigurationPanel at line 602, column 42
    There have been deprecation warnings. Please consult the documentation for a better alternative.When compiling the JAVASOUNDDEMO sample it fails...
    "CapturePlayback.java": cannot find symbol; symbol: class ControlContext at
    line 57, column 72
    "CapturePlayback.java": interface expected here at line 57, column 72
    "CapturePlayback.java": cannot find symbol; symbol : variable JavaSound,
    location: class CapturePlayback at line 243, column 17
    "CapturePlayback.java": cannot find symbol; symbol : variable JavaSound,
    location: class CapturePlayback.Capture at line 495, column 17
    "Groove.java": cannot find symbol; symbol: class ControlContext at line 67,
    column 63
    "Groove.java": interface expected here at line 67, column 63
    "Groove.java": cannot find symbol; symbol : class TempoDial, location:
    class Groove at line 73, column 5
    "Groove.java": cannot find symbol; symbol : class TempoDial, location:
    class Groove at line 73, column 31
    "JavaSound.java": cannot find symbol; symbol : variable JavaSoundApplet,
    location: class JavaSound at line 63, column 13
    "JavaSound.java": cannot find symbol; symbol : class Juke, location: class
    JavaSound at line 84, column 15
    "JavaSound.java": cannot find symbol; symbol : class Juke, location: class
    JavaSound at line 84, column 31
    "JavaSound.java": cannot find symbol; symbol : class ControlContext,
    location: class JavaSound at line 104, column 11
    "JavaSound.java": cannot find symbol; symbol : class ControlContext,
    location: class JavaSound at line 109, column 11
    "JavaSound.java": cannot find symbol; symbol : class MidiSynth, location:
    class JavaSound at line 151, column 9
    "JavaSound.java": cannot find symbol; symbol : class MidiSynth, location:
    class JavaSound at line 151, column 35
    "JavaSound.java": cannot find symbol; symbol : class Groove, location:
    class JavaSound at line 157, column 9
    "JavaSound.java": cannot find symbol; symbol : class Groove, location:
    class JavaSound at line 157, column 29
    "JavaSoundApplet.java": cannot find symbol; symbol : class JavaSound,
    location: class JavaSoundApplet at line 46, column 13
    "JavaSoundApplet.java": cannot find symbol; symbol : class JavaSound,
    location: class JavaSoundApplet at line 55, column 51
    "Juke.java": cannot find symbol; symbol: class ControlContext at line 60,
    column 88
    "Juke.java": interface expected here at line 60, column 88
    "Juke.java": cannot find symbol; symbol : variable JavaSound, location:
    class Juke at line 155, column 13
    "Juke.java": cannot find symbol; symbol : variable JavaSound, location:
    class Juke.JukeTable at line 850, column 21
    "MidiSynth.java": cannot find symbol; symbol: class ControlContext at line
    50, column 50
    "MidiSynth.java": interface expected here at line 50, column 50
    "MidiSynth.java": cannot find symbol; symbol : variable JavaSound,
    location: class MidiSynth.RecordFrame at line 768, column 21
    "MidiSynth.java": cannot find symbol; symbol : variable JavaSound,
    location: class MidiSynth.RecordFrame at line 796, column 17
    I figure that the common thing is the javax libraries.
    I am assuming that these libraries are part of the IDE.
    Please someone help me out.
    Phil

    Your my hero!
    Forgive the innuendo. THANK YOU!!I have the serialDemo working and I guess the same sort of errors once corrected will sort out the soundDemo.
    Regards,
    Phil

  • Serial port prob

    Hi,
    I'm testing some application using javax.comm.* serial communication package.
    Problem some data is missing after some time connection, any one have any clue?
    Below is the code snippet.
    ====================
    Open Connection
    =============
    public void openConnection() throws SerialConnectionException {
              // Obtain a CommPortIdentifier object for the port you want to open.
              try {
                   portId = CommPortIdentifier.getPortIdentifier(parameters
                             .getPortName());
              } catch (NoSuchPortException e) {
                   throw new SerialConnectionException(e.getMessage());
              // Open the port represented by the CommPortIdentifier object. Give
              // the open call a relatively long timeout of 30 seconds to allow
              // a different application to reliquish the port if the user
              // wants to.
              try {
                   sPort = (SerialPort) portId.open("SerialDemo", 30000);
              } catch (PortInUseException e) {
                   throw new SerialConnectionException(e.getMessage());
              // Set the parameters of the connection. If they won't set, close the
              // port before throwing an exception.
              try {
                   setConnectionParameters();
              } catch (SerialConnectionException e) {
                   sPort.close();
                   throw e;
              // Open the input and output streams for the connection. If they won't
              // open, close the port before throwing an exception.
              try {
                   sPort.setInputBufferSize(999999999);
                   os = sPort.getOutputStream();
                   is = sPort.getInputStream();
                   dis = new DataInputStream(is);
              } catch (IOException e) {
                   sPort.close();
                   throw new SerialConnectionException("Error opening i/o streams");
              // Create a new KeyHandler to respond to key strokes in the
              // messageAreaOut. Add the KeyHandler as a keyListener to the
              // messageAreaOut.
              keyHandler = new KeyHandler(os);
              messageAreaOut.addKeyListener(keyHandler);
              // Add this object as an event listener for the serial port.
              try {
                   sPort.addEventListener(this);
              } catch (TooManyListenersException e) {
                   sPort.close();
                   throw new SerialConnectionException("too many listeners added");
              // Set notifyOnDataAvailable to true to allow event driven input.
              sPort.notifyOnDataAvailable(true);
              // Set notifyOnBreakInterrup to allow event driven break handling.
              sPort.notifyOnBreakInterrupt(true);
              // Set receive timeout to allow breaking out of polling loop during
              // input handling.
              try {
              sPort.enableReceiveTimeout(30);
              } catch (UnsupportedCommOperationException e) {
              // Add ownership listener to allow ownership event handling.
              portId.addPortOwnershipListener(this);

    Placing a delay is not the solution.
    Have a look at the code snippet that I posted here:
    http://forums.ni.com/t5/LabVIEW/Reading-time-interval-of-serial-port/m-p/1529140#M568806
    The modified code is also attached in that post. 
    The solution is to place the serial read inside a loop which continues to read until there is no more data in the buffer. 

  • Help please on Observer / Observable and Serial Communications!

    Help!
    I have a project where I need a java application to talk to some test equipment via the serial port. I have studied the java comm api and played around with the SerialDemo example which I used to model my code.
    I have a SeialConnection class which is very similar to the example except I made it to extend Observable and I have it notify observers when data is detected on the serial port.
    I created a second class which extends Obserable which communicates with the SerialConnection and implemented the observer interface. This class process the incomming and outgoing data and provides some higher level methods, like getSerialNumber(), for my application to use. The application frame is an Observer of this class so the GUI can show the status as well.
    An example method from this class:
    private String Get590AROMString() {
    SendString("EZR-V"); //Send a command to the s.p.
    serialConnection.pause(750); //Basically a sleep(750)
    return ROMVersion; //Return the data from update()
    Excerpt from update method:
    // If return from serialConnection starts with VER: parse the RV and SN.
    if(T.startsWith("VER:")) {
    ROMVersion = new String(T.substring(0,T.indexOf('~')));
    SpeciesName = new String(T.substring(T.indexOf('~')+2));
    return;
    This works great when the test equipment sends a message or when the user selects a command from the program interface. My problem is when I try to send a command to the serial port from within the update method of the observer. There are instances where a result from the serial port needs to initiate another request for information.
    Here is a fragment from the update method of the application frame:
    public void update(Observable obs, Object obj) {
    DensTalkStatus DTS;
    if( obs==DT ) {
    DTS = (DensTalkStatus)obj;
    else if(DTS.GetStatus()==DensTalkStatus.NOTIFY_ZEROOK) {
    if(FIRSTCONNECT590A) {
    GDD.GetDensimeterInfo(); // *** This is the Request
    GDD.SetDensID(EDM);
    FIRSTCONNECT590A = false;
    When I make a request for additional information from the serial port within the update method I get nothing returned and the requested data arrives later after the update method has completed.
    I do not know the fine details of how the javax.comm or observer/obserable works but it appears to me that my strategy can only process one command at a time.
    Can anyone think of a way to allow the application's frame update method to request information and wait for the data to be ready?
    Does anybody have an example of how to do this type of communications?
    I am sorry for the length of this question... Thank you for your time.
    Doug

    I have not received any suggestions yet on an alternate method for this problem, but I have come up with a solution I think will work. I am posting it here so others who have the same problem can at least see what path I followed...
    The basic problem seems to be that I am trying to have my observer ask for information that requires the same observer / observable thread to respond.. duh! :) To requst additional information from the serial port I need to move the requests out of the update() method to a different thread.
    I implemented the SerialWorker class to make the request so the observer update() method could return normally without waiting for the result of the new request.
    Doug

  • Stroring certain details in a file, But Could not delete the File.

    I am storing certain details using serialization. But when i decide to delete the File i am unable to delete the File. I am attaching a sample Code to understand my problem.
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import java.io.Serializable;
    public class SerialDemo implements Serializable {
      public static void main(String[] args) {
        try {
            FileOutputStream f = new FileOutputStream("./test.proj");
            ObjectOutputStream s = new ObjectOutputStream(f);
            SerialDemo d = new SerialDemo(5);
            s.writeObject(d);
            s.flush();
            FileInputStream f = new FileInputStream("./test.proj");
            ObjectInputStream s = new ObjectInputStream(f);
            SerialDemo d = (SerialDemo) s.readObject();
            System.out.println(d.getIndex());
            s.close();
            f.close();
            System.out.println("SerialDemo.getVal() is: " + d.getVal());
          File file = new File("./test.proj");
          System.out.println(file.delete());
        } catch (Exception e) {
          e.printStackTrace();
      int test_val = 7; // value defaults to 7
      public SerialDemo() {
        super();
      public SerialDemo(int x) {
        super();
        test_val = x;
      public int getVal() {
        return test_val;
      private int idx = 2;
      public int getIndex() {
        return idx;
      static final long serialVersionUID = -4717603181820250815L;
    }

    Glad I could help. I recommend you look into using FindBugs, it will warn you of this kind of thing. Also change the way you open/close streams to:
    YourStream stream = null;
    try {
       stream = new YourStream();
       // read/write from
    } finally {
      try {
         stream.close();
      } catch( IOException ioe ) {
          // Log the IOE. Or use the IOUtils.quiteClose from Commons IO.
    }As otherwise you could leave the stream open, i.e. if the read() method throws an IOE.

  • COMM API problem

    Hello there
    I am hoping you can help me with following. I am trying to transfer files from one computer
    to another using a serial port and hence I am using the communications api. I have gotten so
    many errors on the problem. I have followed the information for installing the api but I
    still get errors. It will let me compile a file but when I try to run it it give me the
    following error
    NoClassDeffounder found
    What my lecturer did was opened up the jar file and put them into a separate folder. We then
    put them into the bin directory in the jdk.
    Everywhere in the code where it was calling a class,constant belong to the api we did the
    following
    comm.CommPortIdentifier.getPortIdentifiers();
    In the above line comm is the folder with the class files
    When we try to tun it now it executes.But it still cannot find any ports whatsoever
    Please can anyone at all help. I am stuck on this problem for over a month and is slowing me down
    Thanks

    No the code has not come from my tutor
    I've had 2 experts trying to help me and they dont
    know what the problem is
    I have tried the SerialDemo
    I still get the same result
    Any other ideasIf you have followed these instructions to the letter, which I doubt, then you probably need to re-install Windows.
    If they haven't fixed this relatively simple problem they are not experts. Consultants perhaps, but not experts.

  • Using comm.jar

    I'm trying to use serial port to configure a device. I've installed the javacomm20-win32, and copied the comm.jar and javax.comm.properties file in c:\j2sdk1.4.2_04\lib and the win32com.dll in c:\j2sdk1.4.2_04\bin and then added comm.jar to my classpath in Netbeans. The problem is the serialdemo example included in javacomm20-win32.zip doesn't work because it can't find any port. It seems like javax.comm.properties is not installed but it is ! I don't know where's the problem, I would appreciate any help.
    Thank you in advance.

    I got the same problem !!!
    HELOW,
    IS ANYBODY IN THERE? (Pink Floyd)
    Sun people: Could you help us here please?
    I know it's hard to answer the same answer doezens of times. At least guide us to a doc or URL...
    bye

  • NullPointerException on SimpleWrite ( commapi )

    Hi,
    When trying to run the commapi "SimpleWrite" example on Windows 2000 I get a NullPointerException error. (I'm using tera term pro)
    On the same machine with the same setting I have no problem running the commapi "SerialDemo" example.
    Does anyone have any idea? suggestions?
    thank you in adavnce,
    haggai.

    The source code comes with the demos.

  • Version in-compatibility

    Dear all,
    There seems to be a version incompatibility wrt javax.comm package. Because the SerialDemo.java that's provided by sun works perfectly with with jdk1.1.8 but cannot work with jdk1.3.1_02. With jdk1.3.1_02, i cannot see the port locations as i run SerialDemo.java. Can anyone please advice me on how to resolve this matter? Is there some ways that i can do to make the port locations appear? Will it work on the new jdk1.4? Thank you very very much.

    Anything prior to 1.2 version of Java isn't going to be gauranteed to work with 1.2 or above. However, if something works in 1.3, it will work in 1.4.

  • Facing NullPointerException pls help~

    when I call OpenConnection()
    the NullPointerException occur in
    sPort = (SerialPort)portId.open("SerialDemo", 30000);
    how to solve it ?
    scope=application
    package home;
    import java.io.*;
    import java.util.*;
    import javax.comm.*;
    public class SerialBean implements SerialPortEventListener, java.io.Serializable{
         private static CommPortIdentifier portId;
         private static Enumeration portList;
         private static boolean open;
         private static InputStream is;
         private static SerialPort sPort;
         private static OutputStream os;
         private static int outSwitch=0;
         private static int inStatus;
         private static int inData=0;
         private static boolean bInStatus[]=new boolean[8];
         public SerialBean(){}
    public synchronized void OpenConnection(){
         try {
              portId = CommPortIdentifier.getPortIdentifier("COM1");
         } catch (NoSuchPortException e) {}
    try {
    sPort = (SerialPort)portId.open("SerialDemo", 30000);
    } catch (PortInUseException e) {}
    try {
    is = sPort.getInputStream();
    os = sPort.getOutputStream();
    } catch (IOException e) {}
         try {
    sPort.addEventListener(this);
         } catch (TooManyListenersException e) {
         sPort.close();
    sPort.notifyOnDataAvailable(true);
    try {
    sPort.setSerialPortParams(9600,
    SerialPort.DATABITS_8,
    SerialPort.STOPBITS_1,
    SerialPort.PARITY_NONE);
    } catch (UnsupportedCommOperationException e) {}
    // Set receive timeout to allow breaking out of polling loop during
         // input handling.
         try {
         sPort.enableReceiveTimeout(30);
         } catch (UnsupportedCommOperationException e) {     }
         try {
              sPort.enableReceiveThreshold(1); // remark: set Threshold for 1 to receive 1 byte
              }catch (UnsupportedCommOperationException e){}
         open=true;
    /*boolean[] bool = new boolean[8];
    for (int i = 0; i < 8; i++)
    bool[i] = (b & (1 << i)) > 0;
    b = 0;
    for (int i = 0; i < 8; i++) {
    if (bool)
    b |= 1 << i;
    public void serialEvent(SerialPortEvent event) {
    switch(event.getEventType()) {
    case SerialPortEvent.BI:
    case SerialPortEvent.OE:
    case SerialPortEvent.FE:
    case SerialPortEvent.PE:
    case SerialPortEvent.CD:
    case SerialPortEvent.CTS:
    case SerialPortEvent.DSR:
    case SerialPortEvent.RI:
    case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
    break;
    case SerialPortEvent.DATA_AVAILABLE:
         while (inData != -1) {
         try {
              inData=is.read();
         if (inData == -1) {
              break;}
    // insert method
    } catch (IOException e) {}
    break;
         public void SendData(){
         try {
    os.write(outSwitch);
    } catch (IOException e) {}
         public void setOutSwitch(boolean outData[]){
              int comSwitch=0;
              for (int i = 0; i < 8; i++) {
                   if (outData[i]){
                   comSwitch |= 1 << i;
              this.outSwitch=(inData^comSwitch)^outSwitch;

    If this code throws an exception
    try {
    portId = CommPortIdentifier.getPortIdentifier("COM1");
    } catch (NoSuchPortException e) {}you'll get a NullPointerException if you try to use portId as it would contain null, and as you're swallowing the exception you don't know if it has worked. At the very least I would print out the error message.
    Col

Maybe you are looking for

  • Simple Portal Installation on Solaris 9 fails

    Simple installation with no existing Directory Server fails on Solaris 9 with Java problems. The LDAP Server is running and seems to be configured correctly. Any hints?? Setup /var/sadm/install/logs/pssetup.4359/tmp/response/jdk BASEDIR=/opt IDSAME_B

  • TDS on Provision -Mar09

    Dear All, Can anyone suggest how to pass the Provision entry for TDS which we have to pay on 29May09, Bills are yet to be received but we have to pass these provision entries with TDS deduction. If we pass manually thru F-02 For eg. Provision a/c Dr

  • URL generation in POWL in SRM (Vendor empanlement Request)

    Dear Experts, We have hosted our SRM Setup on Internet for Vendors. All links are working fine but the display link in POWL screen is opening up with "Internalserver url" Please let me know if we need to do some setting in POWL to make it call extern

  • Magritte HFM application using LCM

    hi,all: we have a problem while move the HFM applicaion to another one using LCM. OS:windows server 2003 version:11.1.1.3 Migration Status Report: importArtifact(s) 的产品状态输入流解析失败.异常 - [MESSAGE - java.io.UTFDataFormatException: invalid byte 2 of 2-byte

  • Lightroom 5 redemption code.

    Purchased this software, but I'm having difficulty retreiving a serial number. Any suggestions would be appreciated.