Java Communications API (JCA) is really that difficult???
Hi everyone, I am an advanced developer for some years in Microsoft Platforms (.NET, VS6, etc.). I have used Microsoft Programs for a while and I can certainly say that I can develop serious programs.
The reason I am posting this is that I am doing some reaserac in the usability of other programmer platforms for windows and linux.
I turned towards Java about a month ago. I kno very well the structure of the language but I came across something very silly:
I tried to install the javax.comm package! Ha ha ha...
I thought SUN is a serious company (one o the largest) and I keep wondering why this package is so difficult to install. I tried every single post on the forums and nothing worked for me. I am using sdk1.4.1
with SUN Studio One update 1 (formerly Forte, ha ha).
IS THERE ANYONE OUT THERE THAT HAS THE API WORKING ON A WINDOWS 2000 PLATFORM (language doesn't matter but the answer -please- must be in english...) THAT CAN GIVE ME THE MAP OF FILES LIKE:
c:\j2sdk1.4.1\bin\win32comm.dl
c:\j2sdk1.4.1\lib\javax.comm.properties
c:\j2sdk1.4.1\lib\ext\javax.comm
c:\program files\java\j2re1.4.1\lib\javax.comm
Classpath = <somthing>
etc.
Please, I can't get this working. I need to see the damn package in the Studio so that I can work properly..
CAN THIS API ORK WITH THE STANDARD EDITION OF JAVA AND THE COMMUNITY EDITION OF FORTE???
Hi,
Acneto, the jar file must be mounted and the
the parser must be updated. If the api is installed
correctly (finally i have it running) then the ide is
able to compile and run programs that are associated
with the api.That's what I've told you before...I've installed the commAPI in windows 98, Me, 2000 and XP...
The problem with installing the API (I haven't told you before because I thought you already done it...) is with the "java home". Lots of people think that their java home is the jdk\lib and may be the c:\windows\java\lib...or other. And other people think that their java home is c:\windows\java\lib and then discover that is \jdk\lib.
So what I always advice is to make a little problem:
class JavaHome
System.out.println("My java home is:"+System.getProperty("java.home"));
}And so copy the files in the wrong place...
(I don't know if there is a different way to update
the parser database without adding the jar to the
filesystem).I don't think so...anyway, you can mount the jar, update the database, and then unmount!
I will make a post today that indicates a way of
installing the api succesfully under win2K pro with
j2sdk1.4.1 and Sun Studio One update 1 IDE.
By the way, I believe that a special forum regarding
serial and parallel port communications should be
launced by SUN. There are just too many ppl out there
that make such applications.I agree with you!
Best regards,
ANeto
Similar Messages
-
Java Communications API and Java SDK 1.4.2
I just installed the Java Communications API 2.0 on my Windows XP system, with JDK 1.4.2. As per the install instructions, I copied files from the zip into my /lib and /bin directories and set the classpath. However, when I attempt to compile any of the samples, the compiler displays a large number of errors. I know the API documentation only references JDK1.2 -- are there any special tricks to installing on newer JDKs, or will I need to acquire an older JDK to develop?
My path variable is still not being set! Here is the content of my autoexec.bat located on the root directory of C:\
rem - By Groove Setup
PATH=%PATH%;"C:\Program Files\Groove Networks\Groove\Bin"
PATH=%PATH%;C:\PROGRAM FILES\J2SDK1.4.2_07\BIN
/code]
When I type 'path' at the MSDOS C:\ prompt, I receive the following in the get the following:C:\WINDOWS;C:\WINDOWS\COMMAND;\C:\PROGRAM FILES\GROOVE NETWORKS\GROOVE\BIN
As an aside, I noticed that when I perform a search of the my hard drive (c:\), I find two autoexec.bat files. One at the root, and the other in C:\Windows\Command\EBD.
I believe the instructions stated to modify the autoexec.bat at the root directory.
TIA for any assistance. This is really becoming a nusance and taking up quite a bit of my time trying to resolve this problem. -
Hi
I've written a program to communicate with a circuit with JCA throught LPT Port. I have done this:
import java.io.*;
import java.util.*;
import javax.comm.*;
public class test65{
static Enumeration portList;
static CommPortIdentifier portId;
static int num = 8;
static ParallelPort parPort;
static OutputStream outputStream;
public static void main(String arg[]){
portList = CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements()) {
portId = (CommPortIdentifier) portList.nextElement();
if (portId.getPortType() == CommPortIdentifier.PORT_PARALLEL) {
System.out.println ("Found Parralel Port :"+portId.getName());
if (portId.getName().equals("LPT1")) {
try {
parPort = (ParallelPort)portId.open("Robotics", 2000);
} catch (PortInUseException e) {
System.out.println("ERROR: This port is in use by: "+e.currentOwner+".");
try {
outputStream = parPort.getOutputStream();
} catch (IOException e) {
System.out.println ("ERROR: IO Exception.");
parPort.close();
} catch (NullPointerException e){
System.out.println ("ERROR: OutPutStream could not be Created.");
parPort.close();
try {
System.out.println ("Number "+num+" is about to be sent ....");
System.out.println ("Mode : "+parPort.getMode());
outputStream.write(num); //(1)
System.out.println ("Number "+num+" was Sent.");
} catch (IOException e) {
System.out.println ("ERROR: Could not Write Output");
parPort.close();
in the line that writes num to the stream,(1), program stops and doesn't send anything. If i install a printer then the num is sent to the printer driver to be PRINTED. i don't want to print anything. I've think if there is any driver that sends to the port whatever it recieves. What should i do to send numbers to LPT port like outp and out commands in basic and c ?When using java communications api you need to simulate a centronics printer circuit in order to get output to the pins all this requires is that you pull pin11 (Busy) low, pin12 (Paper Out) low, and pin15 (Printer Error) High, although I've only had success thus far using spp mode which of course only supports output. Good luck all.
-
About Java Communication API for Windows
hi
I'm studying Serial Communication in university.
I'd like to know the reason why we can't downlaod Java Communication API for Windows.
I confirmed Comm for Linux and Soralis, but I can't find Comm for Win.
Please tell me the reason if someone know.For no particular reason Sun stopped supporting the windows version
of that package. I use rxtx which happens to allow for much faster
communication too.
The interface is identical to Sun's version, just the package differs: "gnu.io".
kind regards,
Jos -
Problem with Java Communication API
hi
I installed the Java Communication API on win32 platform (as per the guidelines)
Now when I try to run the sample program 'Blackbox' for the serial port, I get an error (in fact an exception is generated inside main function in BlackBox.class file)
I tried the SimpleRead.java example but that too generated the same exception
Can anybody help me out.... I am a novice with Java Comm APII tried running the sample BlackBox program provided for serial port and now it says
No Serial Ports Found!
I verified that both comm.jar and javax.comm.properties are in the <JDK>\lib directory.
Actually, I am using netBeans IDE 1.4 and I used the C:\J2SDK folder installed with netBeans for the Java Communicaion API
plz help. -
Problem with java communication api for gsm modem port
Hi,every body
Am using gsm modem in my project previously my linux is 32bit with 32 bit jvm of sun that time there was no problem at the time of working with gsm modem port .But now am using 64bit linux then 32bit files are not supporting to communicate with gsm modem port .How can i get java communication api for unix 64bit ,64bit jvm of sun.please any body help me ...i am searching in sun/oracle also for downloading java communication files of 64bit jvm but i didn't get the link... i need bellow java communication api files.
ex:1)libLinuxSerialParallel.so
2)javax.comm.properties
3)comm.jar
4)commtest.jarModerator Action:
This duplicate cross-post is locked.
Stay with your original post.
https://forums.oracle.com/thread/2602063
(... and your hijack reply to a third thread has been removed.) -
Identifying a comm port using java communication API
HI ALL,
i'm using the communication API to detect the comm port to which my modem is attached.
i say CommPortIdentifier c = CommPortIdentifier.getPortIdentifier("COM3");
then i SOP(c.getName())
i get an exception saying noSuchPortException
i've put the javax.comm.properties file in jdk/lib but to no avail.
i also have a win32com.dll file that is there inside lib.
but this hasn't helped. Now the properties file has a driver mentioned. do i have 2 download that driver or does it come with the OS (i've no idea)
i would be helpful if anybody could help me out with this problem.Try putting tha javax.comm.properties file in you <java>/jre/lib folder as well... It worked for me !
-
Newbie question on the Java communications API
Hi All,
I found the javax.comm extension package that lets me listen to the serial port of the PC, but am unsure as to how to use it. Well, I've tried running the SimpleRead.java program and I get an error message that says the package is missing in the import (which I assume means that I havent downloaded it and added it to one of the folders in my Java directory). Where can I find the package from? And am I missing anything else?
In case you're all wondering, I've got a microcontroller attached to the serial port that sends data periodically. I would like to use the Java comm API to read the incoming data (and if possible store it in the form of a text file or something). Any suggestions would be great as I'm still new to Java. More of a C/C++ person (^_^) Thanks in advance.....Did you try using that little search field in the upper right hand corner of your browser?
-
Java communication api for windows 64 bit
Hi,
I need communication api for windows 64 bit. Are these api's in developement?
Thanks,
Andrea TodeschiniIf you use version 2.0 of the rxtx library then it provides a complete implementation of the javax.comm package.
Version 2.1 does not (its in the gnu.io namespace)
// Try the following url
http://users.frii.com/jarvi/rxtx/download.html
matfud -
How to distrubute java communication api ?
hi , I have a java project using java comm api (comm.jar) I need to distrubute it to clients (because it is an applet based app) without any user interactivity.
First I remember Webstart but somewhere I read some bugs about comm.api and webstart so I want to ask first Is there any people here used to developed and distrubute comm.api before ? What did you used ?
My clients has no knowledge about computers,so It should be some automatic process.What about my suggestion in your original post regarding the same question?
http://forum.java.sun.com/thread.jsp?thread=412320&forum=31&message=1814508 -
Having problem with Java Communication API
I am using this code to list the port that i have but it does not return any thing. when i compile and run nothing is printed out. i think either its not going in while loop but if i remove while loop it returns NULL. so i think its not recognizing any PORTS. i want to detect a modem port as i want to make a voice mail software. I am jsut starting by listing, opening and listening to the ports. Please help me ASAP. Thank you.
import javax.comm.*;
import java.util.*;
public class PortLister {
public static void main(String[] args) {
Enumeration e = CommPortIdentifier.getPortIdentifiers();
while (e.hasMoreElements()) {
System.out.println((CommPortIdentifier) e.nextElement());
}Go back where you downloaded the API and read the FAQ. I think it's the question number 2.
-
Really that difficult to get answers
Been a customer for a very long time. Decided to sign up for their wireless hotspot device which was an extreme mistake. Thought it would save some money seeing how I got rid of my home internet service. Sounded great in the beginning but then each month my charges started to get larger and larger. I called the help service for this company and the guy who happened to take my call proceeded to tell me that maybe I should change my password. REALLY???? I live in the country, have three houses around me who the owners happen to be old enough to not know how to hack my wireless account. Ohhhhhh no they all of a sudden are computer hackers. NOPE dont think so. Since I purchased this service and have changed my account around I havent started watching videos or keeping my wireless service on during the day while my wife and I are at work. ALL I WANT TO DO IS CANCEL THIS SERVICE. Why does the website make it sooooooo difficult to do so? I am so ready to leave this company after years of service. This sucks and so does your service verizon. In fact I wouldnt be surprised if you were secretly charging each customer like you are me....... maybe not as much but to think about it every extra 2, 3, 4 or 5 dollars times the amount of customers you have adds up. Let me out of my contract. I am going to SPRINT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
In the time it took you to type out that rant, you probably could have called in to cancel your service and had Sprint!!!! on the line getting everything setup so they could rip you off as well. Lots of bark, not so much bite DONEWITHYOU! Put on your big boy pants and cancel already!
-
ERP (Abap) to NW (Java)-Communication with JCA (inbound) in EJB
Hello,
i found examples which use JCA for outbound-communication from java-ejbs to an abap-system. but i didn't found much about how to implement inbound-communication. So i want to call an java-ejb on my NWCE 7.1 (JCA 1.5) from an Abap-System.
Has anybody more information or code snippets how to achive this?
thx and regards
MatthiasHi,
Refer these links,
http://help.sap.com/erp2005_ehp_04/helpdata/EN/83/c70242e5216324e10000000a1550b0/frameset.htm
http://help.sap.com/erp2005_ehp_04/helpdata/EN/32/43d84072378031e10000000a1550b0/frameset.htm
http://help.sap.com/erp2005_ehp_04/helpdata/EN/42/f024227e203ee4e10000000a1553f6/frameset.htm
Regards,
Sunaina Reddy T -
Problem in sending SMS via using java communication API
I need to send SMS via my sony ericsson Z530i. It is connected to the com5 port of my system. I got the following code.
import java.io.*;
import java.util.BitSet;
import javax.comm.*;
import java.lang.*;
public class SerialToGsm {
InputStream in;
OutputStream out;
String lastIndexRead;
String senderNum;
String smsMsg;
SerialToGsm(String porta) {
try {
// CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier("com5");
CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(porta);
SerialPort sp = (SerialPort)portId.open("Sms_GSM", 0);
sp.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
sp.setFlowControlMode(sp.FLOWCONTROL_NONE);
in = sp.getInputStream();
out = sp.getOutputStream();
// modem reset
sendAndRecv("+++AT", 30); // delay for 20 sec/10
sendAndRecv("AT&F", 30);
sendAndRecv("ATE0", 30); // echo off
sendAndRecv("AT +CMEE=1", 30); // verbose error messages
sendAndRecv("AT+CMGF=0", 70); // set pdu mode
// sendAndRecv("AT V1E0S0=0&D2&C1", 1000000);
catch (Exception e) {
System.out.println("Exception " + e);
System.exit(1);
private String sendAndRecv(String s, int timeout) {
try {
// clean serial port input buffer
in.skip(in.available());
System.out.println("=> " + s);
s = s + "\r"; // add CR
out.write(s.getBytes());
out.flush();
String strIn = new String();
for (int i = 0; i < timeout; i++){
int numChars = in.available();
if (numChars > 0) {
byte[] bb = new byte[numChars];
in.read(bb,0,numChars);
strIn += new String(bb);
// start exit conditions
if (strIn.indexOf(">\r\n") != -1) {
break;
if (strIn.indexOf("OK\r\n") != -1){
break;
if (strIn.indexOf("ERROR") != -1) { // if find 'error' wait for CR+LF
if (strIn.indexOf("\r\n",strIn.indexOf("ERROR") + 1) != -1) {
break;
Thread.sleep(100); // delay 1/10 sec
System.out.println("<= " + strIn);
if (strIn.length() == 0) {
return "ERROR: len 0";
return strIn;
catch (Exception e) {
System.out.println("send e recv Exception " + e);
return "ERROR: send e recv Exception";
public String sendSms (String numToSend, String whatToSend) {
ComputeSmsData sms = new ComputeSmsData();
sms.setAsciiTxt(whatToSend);
sms.setTelNum(numToSend);
// sms.setSMSCTelNum("+393359609600"); // SC fixed
String s = new String();
s = sendAndRecv("AT+CMGS=" + (sms.getCompletePduData().length() / 2) + "\r", 30);
// System.out.println("==> AT+CMGS=" + (sms.getCompletePduData().length() / 2));
// System.out.println("<== " + s);
if (s.indexOf(">") != -1) {
// s = sendAndRecv(sms.getSMSCPduData() + sms.getCompletePduData() + "\u001A"); // usefull one day?
// System.out.println("Inviero questo >>>> " + sms.getCompletePduData());
// if this sintax won't work try remove 00 prefix
s = sendAndRecv("00" + sms.getCompletePduData() + "\u001A", 150);
// System.out.println("<== " + s);
return s;
else {
return "ERROR";
// used to reset message data
private void resetGsmObj() {
lastIndexRead = null;
senderNum = null;
smsMsg = null;
public String checkSms (){
String str = new String();
String strGsm = new String();
strGsm = sendAndRecv("AT+CMGL=0", 30); // list unread msg and sign them as read
// if answer contain ERROR then ERROR
if (strGsm.indexOf("ERROR") != -1) {
resetGsmObj();
return strGsm; // error
strGsm = sendAndRecv("AT+CMGL=1", 30); // list read msg
// if answer contain ERROR then ERROR
if (strGsm.indexOf("ERROR") != -1) {
resetGsmObj();
return strGsm; // error
// evaluate message index
if (strGsm.indexOf(':') <= 0) {
resetGsmObj();
return ("ERROR unexpected answer");
str = strGsm.substring(strGsm.indexOf(':') + 1,strGsm.indexOf(','));
str = str.trim(); // remove white spaces
// System.out.println("Index: " + str);
lastIndexRead = str;
// find message string
// look for start point (search \r, then skip \n, add and one more for right char
int startPoint = strGsm.indexOf("\r",(strGsm.indexOf(":") + 1)) + 2;
int endPoint = strGsm.indexOf("\r",startPoint + 1);
if (endPoint == -1) {
// only one message
endPoint = strGsm.length();
// extract string
str = strGsm.substring(startPoint, endPoint);
System.out.println("String to be decoded :" + str);
ComputeSmsData sms = new ComputeSmsData();
sms.setRcvdPdu(str);
// SMSCNum = new String(sms.getRcvdPduSMSC());
senderNum = new String(sms.getRcvdSenderNumber());
smsMsg = new String(sms.getRcvdPduTxt());
System.out.println("SMSC number: " + sms.getRcvdPduSMSC());
System.out.println("Sender number: " + sms.getRcvdSenderNumber());
System.out.println("Message: " + sms.getRcvdPduTxt());
return "OK";
public String readSmsSender() {
return senderNum;
public String readSms() {
return smsMsg;
public String delSms() {
if (lastIndexRead != "") {
return sendAndRecv("AT+CMGD=" + lastIndexRead, 30);
return ("ERROR");
}When i compile, there is no error. But when i execute it, the following error comes:
E:\java\JavaSmsApi>javac SerialToGsm.java
E:\java\JavaSmsApi>java SerialToGsm
Exception in thread "main" java.lang.NoSuchMethodError: main
What might be the error? Somebody help me. Thanks in advance.You are probably trying to run this as a CLDC application instead of a MIDP application (aka a MIDLet). Since CLDC apps start with a main(....) your runtime looks for one but does not find it, hence the error. Please recheck the project configuration.
-
Need API for Java communicating with RS232
Dear All,
I am a newbie to Java. I have a sensor connected to a microcontroller, and this microcontroller is also connected to a PC through the RS232 (COM 1). I have installed the Java Communications API "Javax.comm" on my PC and was able to run the "BlackBox" sample program. What I require is a simple Java program that will read and show the bytes comming through the COM1 port. If anyone has done anything similar or has an idea of how to go about it, could they please send me some example code, I would be very grateful. Or if anyone knows about any website with such similar examples i would be very grateful.
Thank you very much.
FREDERICCross posted numerous times...
http://forum.java.sun.com/thread.jspa?threadID=634826
Maybe you are looking for
-
Hp 3512 with windows 8.1
OPurchased a new dell with windows 8 and my computer says i need an app for it to recognize my hp 3512 printer. How does this work? Wher do i get the app or is there a better way
-
I have Two mac, should I have two iphoto library?
I have two mac, mbp13" and imac white 24" I am facing a big problem with TWO MACs. I went to travel with my mbp13" one week before. I copy the whole iphoto library into mbp in order to sync it with my ipod. Also, I import all the photo into mbp iphot
-
Berkeley DB Storage related questions
Hi, I am new to BDB. We recently migrated our internal DB into BDB (we are using the C++ version). Here are some of the details: Data is saved using hash table (key has a fixed size of 16 bytes, but data size varies - from 20 bytes to a few kbs) We h
-
I have a chart in its own sheet. The chart has one series from another sheet. I'd like to add a series from yet another sheet, but can't figure out how. I can't drag the new series to the chart... thoughts?
-
I do not have the option AUTHORIZE Computer on my Store Screen. Can anyone help me find it?