COMM api ParallelPort locks

Hello all,
I'm trying to use the Parallel Port from COMM api just to send 1 byte to Paralell data I/O using the code below,
portList = CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements()) {
portId = (CommPortIdentifier) portList.nextElement();
portId.getPortType());
if (portId.getPortType() == CommPortIdentifier.PORT_PARALLEL) {
try {
parallelPort = (ParallelPort) portId.open("MoodMusic", 2000);
} catch (PortInUseException e) { }
// Writing to port
try {
outputStream = parallelPort.getOutputStream();
outputStream.write("Hello World".getBytes());
} catch (Exception e) { System.out.println(e.getMesssage());}
And the application keep locked when I proceed the write method,
I do not need read anything from Parallel Port and I have no device connected it.
Is it possible to use the ParalelPort class just to send bytes , It is needed something else to work? or It just work for printers.
best regards,

Thank you very much Jos,You're welcome.
But I really do not understand the solution you proposed, I really need
an answer from device or Could I solve it from PC Host?Sun's API expects that nAck negative pulse; if it doesn't arrive it won't
send new data. You either need to fake that pulse (using a bit of
additional hardware triggered by the strobe signal coming from the host)
or maybe (just a quick idea), you could set a small timeout value and
try to send your bytes one by one. This would slow down the communication
speed substantially but you don't need to build special hardware.
If your device is fast enough it would pick up the eight bits of data and
then Sun's API would time out. This way you also lose quite a lot of
functionality like error detection etc.
kind regards,
Jos

Similar Messages

  • 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.

  • 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?

  • Including a DLL in JAR file (Comm API)

    Writing a little app that interfaces with serial port device using the communications API and I'd like to bundle it into an executable JAR. JBuilder will create the JAR for me fine, but the issue is with the win32com.dll file thats part of the comms API. I need to include this, I don't think its possible to include as part of the executable, but otherwise the DLL needs to be in the windows\system folder. Could I include the dll as part of the JAR archive and then extract it upon runtime? If so how would I go about this?
    Any help much appreciated.

    There is another option. Native libraries need to reside within the java.library.path location. As it turns out, if you, at runtime, grab this property and ADD your own location to it, then set it back in to the System.setProperty() call, it will NOT work. The only way to do it is the -Djava.library.path value that tjmaven suggested.
    However, if you read up on how a native library is found, it uses the ClassLoader.loadLibrary() which calls the protected findLibrary() method. You can therefore extend ClassLoader to find a path yourself.
    One way is to extend URLClassLoader since it has the protection/security stuff AND the ability to look in .jar files for you. Your custom loader is created by a "launcher" class in your .jar file. First, your luancher uses getClass().getProtectionDomain().getCodeSource().getLocation() to get the absolute location of the .jar file its executing within. From there, you open the jar and look for your native library, extract it using the JAR api to a location of your choosing. Now, you instantiate the custom classloader and using this custom loader instance you load the rest of your classes. The main .jar file contains two classes, the launcher and the custom classloader, and contains the native library if you wish to do it this way. The custom classloader, you specify a URL[] of "classpath" entries. You bundle up the rest of your source in a second .jar file that you pass to the URL[] when creating the custom classloader. It will find all your classes in the 2nd jar no sweat. You can even "reload" these classes on the fly by recreating the custom classloader instance if you so wish to add a sort of "reload" feature.
    Now, in your custom classloader, you override the findLibrary() and return the SAME STRING PATH that you used to unjar your native files to. This way, when the JVM asks your custom loader to load the library at some path, you return the right path to find the native files in.
    I haven't verified that this works just yet, but I will soon. Primarily, my plugin engine over at www.platonos.org will support the ability to place native libraries in plugins, allowing you to effectively wrap a native library use as a plugin. Not yet working, but we'll soon have it in place.

  • Stand Alone OC4J  and Java's Comm API

    I am using the Java Comm API alongwith a servlet. The code simply gets the required ports and displays it in a JSP page. The program is developed using Jdeveloper 9. It works fine with embedded OC4J but a blank jsp page is displayed when deployed in in standalone OC4j instance on the same machine. I have correctly copied the required wincom32.dll, java.comm.properites and comm.jar to the jre/bin, jre/lib and jre/lib/ext respectively. What could be wrong.
    Thanks
    MMN

    Try setting the OS PATH env variable to the directory where the .DLL is located before you launch the container. Or else put the .DLL in a directory which is in the existing path.
    cheers
    -steve-

  • 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.

  • Error in the latest Java comm api for Linux

    installed latest Java comm api for Linux, tried test application for the Sun package:
    $ java SimpleRead
    Exception in thread "main" java.lang.ExceptionInInitializerError
    at SimpleRead.main(SimpleRead.java:67)
    Caused by: java.lang.NullPointerException
    at javax.comm.CommPortIdentifier.findConfFile(CommPortIdentifier.java:199)
    at javax.comm.CommPortIdentifier.<clinit>(CommPortIdentifier.java:117)
    ... 1 more
    What deis this message mean? How to make you serial port support work?

    and what does this error message mean??
    The package was installed accordingly to "Java(tm) Communications API Linux Installation Instructions":
    $ls /usr/lib/libLinuxSerialParallel.so
    /usr/lib/libLinuxSerialParallel.so
    $env|grep CLASS
    CLASSPATH=<..skipped..>:/opt/commapi/jar/comm.jar:/opt/commapi/jar/commtest.jar
    $ ls /opt/jdk1.5.0_04/jre/lib/javax.comm.properties
    /opt/jdk1.5.0_04/jre/lib/javax.comm.properties
    What else does it need?

  • Configure comm.api in tomcat

    hello friends,
    i want to configure comm.api in tomcat5.5. please help me
    Thanks in advance.
    javax.comm: Error loading javax.comm.properties!
    null
    java.io.IOException: javax.comm: platform driver class name = null
    (Check 'driver' property in javax.comm.properties)
    at javax.comm.CommPortIdentifier.loadDriver(CommPortIdentifier.java:244)
    at javax.comm.CommPortIdentifier.<clinit>(CommPortIdentifier.java:109)
    at welcome.list(welcome.java:47)
    at welcome.doGet(welcome.java:21)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:627)

    If your operating system works it as a comm port you can readily run the BlackBox example that comes with the comm 2.0 API and see if it picks it up.

  • Problem in Accessing serial port using java comm Api

    I have installed java comm Api in my pc.
    i have gone through the instalation instruction which comes on this package.
    I have done the instalation like this
    Copy win32com.dll to my <JDK>\bin directory.
    Copy comm.jar to my <JDK>\lib directory.
    Copy javax.comm.properties to my <JDK>\lib directory.
    and restart the system.
    But when i run the BlackBox , it is giving me message
    "serial port not found".
    Can any one tell me , what is the exact problem ?

    I'm not sure what you mean by BlackBox, but I have used the COMM api extensively.
    The majority of problems is that the api cannot see the serial port (which is what you are describing) and this is caused by incorrect placing of the javax.comm.properties file.
    As well as <JDK>\lib, try putting it into <JRE>\lib as well. That has often solved problems on my setup.

  • Comm api for windows

    I need to access comm serial port using java.
    I downloaded the comm api for generic. The downloaded file comm2.0.3.zip contains comm.jar only. It does not have window dll that is mentioned in other forums.
    Does it support windows platform? where to get additional files for windows?
    Why is there no samples/docs in the release download?
    Thanks,
    Dave

    You're incorrect. Oracle or rather Sun did provide a Windows port but they withdrew it as Microsoft kept changing the underlying system APIs. There are other implementations of it, such as RxTx.

  • Java comm api doubt.

    ive downloaded the comm api and installed it in my system (win 95) Ive followed exactly all the steps that are recommended and even changed by classpath. I still get the followin error message
    Excpetion in thread "main" java.lang.NoClassDefFoundError : SimpleRead/java.
    Please help.
    thanks
    G.P.

    u were right amolk, i did not include the period and that was the problem. thanks a lot and thank u too DrClap.
    G.P.

  • Using Comm API with Web Start

    I am trying to use Sun's Comm API with Web Start so I can access COM1 from my application.
    When the application starts, I receive an exception for the CommPortIdentifier. When I run this
    application as a standalone, it works fine. I have to assume that there is a problem with the
    deployment of the Comm API.
    I have include the win32com.dll in a jar file and defined it in the nativelib tag in the jnlp file.
    The comm.jar and the javax.comm.properties files are include in another jar. I am not sure
    what is the proper way to deploy these files and cannot find any documentation on this.
    Does anyone know the correct way to handle this?

    I have include the win32com.dll in a jar file and
    defined it in the nativelib tag in the jnlp file.
    The comm.jar and the javax.comm.properties files are
    include in another jar. I am not sure
    what is the proper way to deploy these files and
    cannot find any documentation on this.
    should like like this
    <resources>
    <j2se version="..." href="..."/>
    <jar href="application.jar"/>
    <jar href="comm.jar" />
    </resources>
    <resources os="Windows">
    <nativelib href="win32com.dll"/>
    </resources>
    Then in the code in application.jar, call
    System.loadLibrary("win32com");
    /Dietz

  • Comm Api In IRDA

    I Have connected IRDA in USB and Create a virtual modem com4.My work is to send message between mobile through PC and vice versa.First We work on serial cable connected with my PC and Nokia6610.But
    I face lot of Problem with AT command so I wanna be work with IRDA because All AT command work fine.
    I test it in Hyperterminal.But We will be implemented it only one way and that is comm api.But Comm api works on Serial and Parallal Port.But I create Virtual port com4.Can i do it in comm api with IRDA connection?
    I Want to know Only One Thing----------------
    Can i work IRDA with my comm API?
    (Though It is not connected with the serial port but create a virtual port com4)
    PLS & PLS Help Me Only This ANS.

    If your operating system works it as a comm port you can readily run the BlackBox example that comes with the comm 2.0 API and see if it picks it up.

  • Is Comm Api works in IRDa Conn

    I Have connected IRDA in USB and Create a virtual modem com4.My work is to send message between mobile through PC and vice versa.First We work on serial cable connected with my PC and Nokia6610.But
    I face lot of Problem with AT command so I wanna be work with IRDA because All AT command work fine.
    I test it in Hyperterminal.But We will be implemented it only one way and that is comm api.But Comm api works on Serial and Parallal Port.But I create Virtual port com4.Can i do it in comm api with IRDA connection?
    I Want to know Only One Thing----------------
    Can i work IRDA with my comm API?
    (Though It is not connected with the serial port but create a virtual port com4)
    PLS & PLS Help Me Only This ANS.

    I know it's a few months later... just in case you're still wondering. Yes you can access IrDA through the Comm API check out RxTx.org they have a very active forum

  • Comm api for windows platform

    I want to use comm api with JSP on windows platform.
    I am using Tomcat 5.0 for running JSP.
    On Sun's site comm api available only for solaris and linux platforms.
    what should i do?
    I also want to know prefered settings for configuring comm api with Tomcat. i.e.Where should i put appropriate comm API file in Tomcat?
    Please also mention the necessary settings for classpath.
    Thanks for help in advance.

    Version 2.0 of Java Communications was available for Windows, though I can't see how to download it from the Sun web site now...

Maybe you are looking for

  • Comparison of SSD with hard disk drives

    Attribute or characteristic Solid-state drive Hard disk drive Spin-up time Instantaneous. May take several seconds. With a large number of drives, spin-up may need to be staggered to limit total power drawn. Random access time[45] About 0.1 ms - many

  • Extraction of Stocks for Cutover

    Hi, I have a problem in down loading of stocks.Where can I see the vendor stock with storage location level. In MSLB I have only at plant level. I am downloading the stock from 4.6C from MARD (where I am not getting the valuation type field) table an

  • I have a problem with 2 ROUTERS wrt54gl

    I have a problem with 2 ROUTERS The router has remained and 2 linksys and specific wrt54gl and 2 In one I have connected the DSL line with a modem in the first WAN router which has IP: 192.168.100.1 and connect from Tin's LAN 192.168.100.1 in the sec

  • How to do setup or instalation the authorware file

    I have packed my Authorwae file to .exe frormat for windows so delivered to CD but i needed to do setup or installation fromĀ  CD to Hard disc . the run speed it will be more fast then from cd. Any one can help Thank u

  • Embedding a google form into wiki

    I am using the xserve for a wiki site and I would like to be able to embed a google form into the wiki page. I can do this in wikispaces, but I would like to have it on our own wiki site. I would also like to embed a video that same way. Can this be