Javax Comm

Could anyone please explain the exact use of JAVAX COMM ? (ie what it does ?)

A blackbox is a piece of hardware normally. With this box one can monitor communication lines.
In this case it is a Java application that monitors the hardware (see the readme in the source directory).

Similar Messages

  • Trying to use javax comm api in Windows Environment

    I am working on developing a module to dial a phone number in a Windows environment. This is to test a voicemail connection so it isn't, necessarily, calling a modem.
    A couple of questions:
    1) I found the javax comm api but it appears Sun has only provided a Solaris and Linux version - where would I find a Windows version?
    2) I was planning on dialing a modem with the voicemail phone number (programmatically, of course). I, then, want to recognize response and react to it - possibly stopping only with seeing that the phone number answered (since I don't want to write voice recognition software). Am I on the right track?
    Ed

    I don't know of any devices named "/dev/term/a" - and that's both Linux and Solaris.

  • Javax comm 2.0 API

    Hello everyone.
    Do anyone of you know why the new version of comm api (version 3.0) does not support Windows? It is only available for Solaris SPARC, Solaris x86, and Linux x86.
    Therefore, I can only use comm 2.0. But my problem is that although I have managed to connect a GPS device with my desktop, I can not do that with my laptop or a different desktop pc that I have tried.
    The problem is that the application that I have developed can not find the COM port that I describe.
    Any thoughts?
    Thanks a lot
    Pavlos

    http://www.rxtx.org/
    RXTX is an open source javax.comm 2.x compatible package with multi platform support. I use it on all of WinXP/CE, Linux, FreeBSD, OSX and it works like a charm for parallel, serial and serial to USB devices (for GPRS modems and GPS devices specifically). RXTX is nicely abstracted also so you don't specifically need to use anything but the javax.comm interface unless you want to use one of the API extensions (for example clearCommInput() which is a very obvious omission in the javax.comm api - skip() just does not cut it).
    The code itself is not well documented - for the most part you can use the javax.comm documentation or just read the source - but it works, and works very well. Even if the heuristics in the RXTXCommDriver don't automatically find the device (you can check the sources as to why) you can add devices at runtime with CommPortIdentifier.addPortName() if needed.

  • Javax Comm API on linux

    Hi,
    I am using javax comm API on linux. I am using RXTX comm API release 1.4 that uses gnu.io.RXTXCommDriver on J2ME Personal Profile Runtime Environment for x86 Linux Version 1.0.
    When I try to open a serial port, I get javax.comm.NoSuchPortException. What could be the problem? Does the cvm not support comm API. Is there any alternate way?

    I am looking for one too.. i figured better would be to use JNI classes... but i havent yet implemented it.. mebbe that will cause even more problemos..
    please post here if you find smthing

  • Javax comm problems

    Hi,
    I am trying to communicate with the communication ports using javax comm API through an applet.
    I am using Java 1.3.1.
    It gives me the exception:
    java.lang.ClassNotFoundException:javax.comm.commPortIdentifier
    I run the same program not using the applet , it runs fine.(i.e.recognises the ports etc)
    i tried to using a signed applet for the communication and still the exception is raised.
    All the files like comm.jar and properties file and also windriver are located in the reqd locations.else my program would not have run without using the applet.
    Can someone suggest what could be causing this problem
    Thanks
    Sai

    I am having the same problems with this javax.comm package. I am using Java 1.3.1_01 under WIN2K. I checked the hardware profile, and it listed my serial ports. I also have a palmpilot which communicates with this serial port, and it works fine as well.
    I tryed installing it two different ways:
    1.)
    installed it as if I was using jdk1.1.x
    putting the comm.jar package in the <jdkroot>/lib dir
    putting the properties file in the <jdkroot>/lib dir
    putting the dll in the <jdkroot>/bin dir
    adding <jdkroot>/lib/comm.jar to the classpath.
    While this did not give me a runtime error, it would not recognize any of my serial ports.
    2.)
    installed it according to the jdk1.2 documentation
    comm.jar -> <jdkroot>/jre/lib/ext/ dir
    properties -> <jdkroot>/jre/lib
    dll -> <jdkroot>/jre/bin
    not altering the path
    This gave me the following runtime error:
    java.lang.NoClassDefFoundError: javax/comm/CommPortIdentifier
         at VirtualGPSConsoleApp.main(VirtualGPSConsoleApp.java:27)
    Exception in thread "main"
    Process VirtualGPSConsoleApp exited abnormally with code 1
    Please let me know if you make any headway.
    Thank you,
    [email protected]

  • Javax comm package

    Do I need to download the javax comm package or what. If yes , what is url for downloading

    What platform are you using, javax.comm is easy on Windows and Solaris http://java.sun.com/products/javacomm/downloads/index.html. On Linux you will need a third party driver from http://www.rxtx.org/.

  • Javax comm api

    hi all,
    I tend to install the javax comm api on my windows98 se but it seem that I cant find the win32com.dll in the unzipped file.
    I downloaded the javax.comm 3.0, update 1 for Linux plateform, since there is no version for the windows.
    I have tried to enable the view every folder in my view tool but cant seem to work, I still cant see the win32com.dll file.
    Regards,
    Rejina Choi

    hi , I having problem downloading this file ""Comm3.0_u1_linux.zip""" and I need it urgently could someone give me a link where I can download it. Sun say that "Product Not Found The product you requested is not available at this time".

  • Javax comm api tutorial

    Hi!
    I've gone through sun's examples on how to use comm api.
    Are there any detailed tutorials anywhere which one can use to learn the intricacies of the comm api? This is because one can go through the code or even the javadoc and get already written code to run, but a good detailed tutorial somewhere always helps a great deal to really plunge into the essence of the technology in use.
    I'm an undergrad student and my aim is to send AT commands to a cell phone using a JAVA applet as well as receive responses from it through the JAVA applet.
    Thanks alot for all your help.

    This is a very well commented piece of code and is a good tutorial for the javx.comm api!
    http://discussion.forum.nokia.com/forum/showthread.php?s=ffbe2f2bf1e0d951ec1a0867c9470bd0&threadid=27929&highlight=%2Ajavax.comm%2A

  • How to use the COMM API in a JAR file

    I have developed an application, using the NetBeans IDE, to communicate with a modem over the COM1 serial port using the Java Comm API. The application works fine within the IDE, but when a JAR file is created and "double-clicked", the application launches correctly, but when the code is executed to "talk" over the COM1 serial port - nothing happens. No exceptions and no warnings are thrown. My environment is XP, SP1.
    The manifest file is as follows:
    Manifest-Version: 1.0
    Class-Path: ../j2sdk1.4.2/jre/lib/ext/TimerBean.jar ../j2sdk1.4.2/jre/
    lib/ext/AbsoluteLayout.jar ../j2sdk1.4.2/jre/lib/ext/comm.jar
    Created-By: NetBeans IDE
    Specified-By: Projects/TheApp/Files/TheApp.jarContent
    Main-Class: Main
    According to the Comm API installation instructions, the following files are copied:
    copy comm.jar \j2sdk1.4.2\jre\lib\ext
    copy wind32com.dll \j2sdk1.4.2\bin
    copy javax.comm.properties \j2sdk1.4.2\jre\lib
    I suspect it has something to do with the paths.
    Any help would be greatly appreciated. Thanks.

    Thanks for your input, but after trying what you suggested the problem still exists. I think your right to be suspicous of the javax.comm.properties file. The application, that worked in the IDE, exhibits the same behavoir as the JAR file if the javax.comm.properties file is removed from the ../jre/lib directory. In other words it compiles correctly in the IDE, but when executed, nothing happens when the code that "talks" to the serial port is run.
    I've tried moving the javax.comm.properties file into the working directory. Also, the CLASSPATH and PATH system variables were modified to include the path to javax.comm.properties.
    If you have anymore ideas, please let me know.
    Thanks.

  • Java comm api not working in j2sdk1.4

    am doing a sms project in java..
    my code is works fine in jdk1.3 ,but when i tried in j2sdk1.4 it failed
    1.classpath used
    c:\j2sdk1.4.2_08\lib\comm.jar;
    2.copied win32 dll to j2sdk1.4.2_08\ bin
    3.comm.jar and java.properties toj 2sdk1.4.2_08\lib
    also in policy tool,grant allpermissons set
    thkx
    arvind

    i cant run the program in j2sdk1.4
    port is not opening.
    iam using comm.jar,javax.comm.properties ,win32 dll

  • Java comm not working in j2sdk1.4

    pls help..
    am doing a sms project in java..
    my code is works fine in jdk1.3 ,but when i tried in j2sd1.4 it failed
    1.classpath used
    c:\j2sdk1.4.2_08\lib\comm.jar;
    2.copied win32 dll to j2sdk1.4.2_08\ bin
    3.comm.jar and java.properties toj 2sdk1.4.2_08\lib
    also in policy tool,grant allpermissons set
    thkx
    arvind

    i cant run the program in j2sdk1.4
    port is not opening.
    iam using comm.jar,javax.comm.properties ,win32 dll

  • Comm.jar not working in Applet but works in Eclipse

    Hello,
    Please help me to read serial port data from Java Applet.
    The below code working well and get data from weighing machine when we run in eclipse(Run Applet). But it now working when we use class file in Applet.
    I think its security issue, but i still could not understand what we need to do.
    I put the JOptionPane.showDialog and found that the code is crashing in line CommPortIdentifier.getPortIdentifiers(); (Not understood why try catch not working.)
    I am using in Windows 7 environment.
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.event.*;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Enumeration;
    import java.util.logging.Logger;
    import javax.comm.*;
    import javax.swing.*;
    public class SimpleApplet extends JApplet {
    public void init() {
    JButton button = new JButton("Click me!");
    button.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent evt) {                 
         JOptionPane.showMessageDialog(SimpleApplet.this, "hello");
    JOptionPane.showMessageDialog(SimpleApplet.this, Getdata());
    add(button, BorderLayout.CENTER);
    setBackground(Color.GRAY);
    public String Getdata()
         try
              String drivername = "com.sun.comm.Win32Driver";
    try
    CommDriver driver = (CommDriver) Class.forName(drivername).newInstance();
    driver.initialize();
    catch (Exception e) { //just do nothing, it doesn't really matter
         Enumeration portList=null;
    CommPortIdentifier portId;
    SerialPort serialPort;
    OutputStream outputStream;
    try
         portList = CommPortIdentifier.getPortIdentifiers();
    }catch(Exception ex)
         JOptionPane.showMessageDialog(SimpleApplet.this, "erorr:" + ex.getStackTrace().toString());
    JOptionPane.showMessageDialog(SimpleApplet.this, "get port lsit");
              while(portList.hasMoreElements())
                   portId = (CommPortIdentifier) portList.nextElement();
                   if(portId.getPortType()== CommPortIdentifier.PORT_SERIAL)
                        if(portId.getName().equals("COM1"))
                             try
                                  serialPort = (SerialPort) portId.open("WeightMachine",200);                              
                                  serialPort.setSerialPortParams(1200, SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
                                  outputStream = serialPort.getOutputStream();
                                  InputStream mInputFromPort = serialPort.getInputStream();
                                  outputStream.write("W".getBytes());
                                  outputStream.flush();
                                  Thread.sleep(500);
                                  byte mBytesIn [] = new byte[20];
                                  mInputFromPort.read(mBytesIn);
                                  //mInputFromPort.read(mBytesIn);
                                  String value = new String(mBytesIn);
                                  mInputFromPort.close();
                                  serialPort.close();
                                  return value.replace("+00", "").replace(" Kg", "");
                             }catch(Exception ex)
                                  return ex.getMessage();
              }catch(Exception ex)
                   JOptionPane.showMessageDialog(SimpleApplet.this, "erorr last:" + ex.getStackTrace().toString());
              return "Not found";
    Thanks in advance.
    Avinash

    959817 wrote:EJP wrote:959817 wrote:
    it now working when we use class file in Applet.Define 'not working'.But when i run applet from browser from same machine its not working.That's not an answer. That's just a vague and pointless restatement of the original vague and pointless statement that I asked you to clarify.
    When you take your car to a mechanic, do you just tell him it's 'not working'?

  • My last chance...for comm api with applet

    Hi to u great valued developers,
    Did anybody on earth the same as I do:
    Create and deploy a signed applet including the java comm api lib.
    The applet is deployed on an Apache Server and should run under IE6
    Easy? sure but something is certainly missing in the cab 'cause altough no error is return in console, I either do not receive any info from the ports.
    Same app compiled as application is ok.
    Thanks very much for any help.
    Cedric ([email protected])

    Hello Enrique,
    tx for ur answer.
    As said, the application (reading serial ports) works fine.
    The problem come possibly from javax.comm.property.
    Should I package it with the cab?

  • Java Comm API in FreeBSD? HELP!!!

    I'm doing a project for my company that needs to access the serial port, with commAPI the thing works flawlessly under Windows XP, however big problem comes with commAPI doesn't work in FreeBSD which the company server runs on. This is what I have done so far :
    Downloaded the Linux version of comm3.0, and extracted the .so files into /usr/local/java/jre/lib/i386/ directory, the comm.jar into /usr/local/java/jre/lib/ext/ directory, and the javax.comm.properties into /usr/local/java/jre/lib/ directory. The test program compiled fine, but during running it says no port found.
    So I fumbled around and edited the javax.comm.properties file to make the serial port entry cuaa0, and now it finds the port fine, but when it tries to open the port, an error pops up like this
    Exception in thread "main" java.lang.RuntimeException:
    Error opening "/dev/cuaa0"
    lockf(): Invalid argument
    at com.sun.comm.LinuxDriver.getCommPort(LinuxDriver.java:66)
    at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:369)
    at nulltest.<init>(nulltest.java:133)
    at nulltest.main(nulltest.java:76)
    It seems the getCommPort method calls a lockf() function with an invalid argument? Now I'm at a loss of what to do, anyone has any idea how can this be fixed? Thanks!

    It appears there are a number of ports of comm
    packages to FreeBSD, see the referenced page. RXTX is
    one that works well in other environments.
    http://www.freebsdsoftware.org/comms/
    I tried java-commapi-freebsd, but it also reports an error when opening the port
    FreebsdSerial: UnsatisfiedLinkError = /usr/local/java/jre/lib/i386/libSerial.so: /usr/local/java/jre/lib/i386/libSerial.so: ELF file OS ABI invalid
    java.lang.UnsatisfiedLinkError: /usr/local/java/jre/lib/i386/libSerial.so: /usr/local/java/jre/lib/i386/libSerial.so: ELF file OS ABI invalid
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1586)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1503)
    at java.lang.Runtime.loadLibrary0(Runtime.java:788)
    at java.lang.System.loadLibrary(System.java:834)
    at org.freebsd.io.comm.FreebsdSerial.<clinit>(FreebsdSerial.java:85)
    at org.freebsd.io.comm.FreebsdDriver.getCommPort(FreebsdDriver.java:114)
    at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:634)
    at ATTest2.main(ATTest2.java:27)
    Exception in thread "main" java.lang.UnsatisfiedLinkError: deviceOpen
    at org.freebsd.io.comm.FreebsdSerial.deviceOpen(Native Method)
    at org.freebsd.io.comm.FreebsdSerial.<init>(FreebsdSerial.java:115)
    at org.freebsd.io.comm.FreebsdDriver.getCommPort(FreebsdDriver.java:114)
    at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:634)
    at ATTest2.main(ATTest2.java:27)And then I tried RXTX, but it seems that tere's some problem to send the cartridge return character, so I can't send the AT commands properly to get any response. I tried \r \r\n \x0d etc. to no avail. Any idea what's the problem with the java-commapi-freebsd thing, or how to send the AT commands properly with RXTX? Thanks a lot!

  • Getting started in Java Comm API

    Hi This is all new to me. So I would really appreciate if anyone can help me figure this out..I am trying to read from the serial port using a VS4000 Image Scanner(Symbol). I want to scan a driver's license bar code. I believe PDF417 is the type of barcode to read driver's license. However, Im just curious if there is any code out there that actually parses the information out of the license. I need to get the lastname, firstname,dob,gender,address,drivers #, etc.. Does any one have any idea where I could get more information in how to scan a driver's license. I need more guidance in how to really do this. Although, I went to the introduction to Java Communications and found a example code "SimpleRead.java". However, I get some errors....
    can anyone help..I have a nullpointer ..not sure how to fix it...
    I get this error :
    java.lang.NullPointerException
         at SimpleRead.<init>(SimpleRead.java:64)
         at SimpleRead.main(SimpleRead.java:53)
    Exception in thread "main" Process terminated with exit code 1
    Here is the original 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) {
    if (portId.getName().equals("COM1")) {
    //if (portId.getName().equals("/dev/term/a")) {
    SimpleRead 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.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:
    byte[] readBuffer = new byte[20];
    try {
    while (inputStream.available() > 0) {
    int numBytes = inputStream.read(readBuffer);
    System.out.print(new String(readBuffer));
    } catch (IOException e) {}
    break;
    Thanks a bunch!! :)
    Jess...

    I actually got my scanner to work. I got my SimpleRead.java to work as an application. I set up this as an applet. Now my problem is that I the inputread reading from the serial port is not reading correct data always. It sometimes does scan correct data at times and other times it will not. So, I am not sure what is wrong. Does anyone have any clue why this could happen?

Maybe you are looking for

  • Copying directory data from one server to another

    Hi friends, I maintain two directory server (ver. 5.2) with same domain (xxx.com) and i have to copy the entire data from one server. I tried to export from a one server and import it on another server, but it didn't get copied and it is getting obje

  • Issue in updating nomination

    hi All   I am using a Z program for changing the existing nomination and to peg the new line item added to nomintaion with the existing line item . i have used function module OIJPEG_GROUP_ITEMS to peg the items .This function module generates the te

  • My computer is stuck on the screensaver

    All my screen shows is "loading pictures" and the rainbow wheel. I drained my battery but no luck. Took out my battery out and no go. What now?

  • Foreign trade inport /export in  vl01n

    How to remove FOREIGN TRADE/ EXPOR- IMPOT in delivery in vl01n. How to deactivate it.

  • SAP BI - Data Services connection

    Hello I am trying to set up SAP BI - Data Services connection. Couple of questions : 1. Where from within the SAP can I get SAP gateway hostname and SAP gateway service name 2. I have a developer right on BW. Is it enough to make connection with my u