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.
Similar Messages
-
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? -
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. -
Hi,
I am developing an applet which uses Java Comm API. I'm running into some deployment issue. My understanding is that Java Comm API needs to have win32com.dll and javax.comm.properties files installed on the client machine for my applet to use Comm API. Is there a way around this? The ideal way will be to have everything (win32com.dll and javax.comm.properties) in a jar file so that it doesn't need to install any file on the client machine. However looking at previous posts, I don't think that's possible with Java Plug-in. Will I be able to utilize Java WebStart to accomplish this? I'll be interested to find how other people deploy Java Comm API. Thanks in advance.
Regards,
JoyI�ve developed a solution to this problem. I created a class that creates the javax.comm.properties file where the comm.jar lib looks for it. The trick is to run the method that creates the file before the lib looks for it.
I show you the example of my code:
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public final class PrinterInit {
public static void printerInit(){
String archivoConf =
System.getProperty("java.home") + File.separator + "lib" +
File.separator + "javax.comm.properties";
try {
BufferedWriter out = new BufferedWriter(new FileWriter(archivoConf));
out.write(
"#"+ "\n" +
"# Drivers loaded by the Java Communications API standard extension"+ "\n" +
"# at initialization time "+ "\n" +
"# "+ "\n" +
"# Format: "+ "\n" +
"# Each line must contain ONE driver definition only "+ "\n" +
"# Each line must be of the form: "+ "\n" +
"# driver=<ClassName> "+ "\n" +
"# No spaces or tabs in the line. "+ "\n" +
"# ClassName must implement the interface javax.comm.CommDriver "+ "\n" +
"# example: driver=Win32Serial"+ "\n" +
"# "+ "\n" +
"#"+ "\n" +
"# The hash(#) character indicates comment till end of line."+ "\n" +
"#"+ "\n" +
"# Windows Serial Driver"+ "\n" +
"Driver=com.sun.comm.Win32Driver" + "\n");
out.close();
} catch (IOException e) {
System.err.println("No se pudo crear el archivo:" + "javax.comm.properties");
System.err.println("Ruta completa:" + archivoConf);
}Before opening the port I call
PrinterInit.printerInit();This example writes de javax.comm.properties file needed for a windows implementation. You can change the value of the Driver property for the system you are using.
Good Luck! -
I apologise if this is off-topic. I can't find a suitable forum, I tried posting in the Java plugin forum, but no luck there. I would appreciate any ideas to find a solution.
I am trying to use the java comm api to read and write to the serial port but I am getting the following error:
Error loading LinuxSerialParallel: java.lang.UnsatisfiedLinkError: /usr/lib64/libLinuxSerialParallel.so: Can't load IA 32-bit .so on a AMD 64-bit platform
I am using openSUSE 10.2 (X86-64) which uses Linux 2.6.18.2-34-default x86_64.
I tried Switching to a 32-bit version of java (1.4.2) from within Eclipse and I always run Eclipse in 32-bit java (/usr/share/eclipse/eclipse -vm /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre/bin/java) but I still get this error.
Is there anything I can do to get the java comm api working on a 64-bit system?
Is the java comm api still being developed and maintained? It does not look like it is?
I've done some searching on the web and I find there is an open source version of the java comm api called RXTX but the website at http://www.rxtx.org/ is not very readable. I don't think I know enough to install this on my system.
I would appreciate any ideas to get this working.
Thanks,
MartinI'm stuck again so I would appreciate some more help.
I've managed to install the Sun 1.6 JDK and configure
and make rxtx.Any small amount of progress is still progress. :)
>
But it still does not work, I get the following error
when I run the SerialDemo:<snip>
>
It seems to be com.sun.comm which is not finding its
native binary not rxtx! No, it's finding the shared library, unless there are a few more lines at the start of your error message that look like this:
Error loading LinuxSerialParallel: java.lang.UnsatisfiedLinkError:
no LinuxSerialParallel in java.library.pathIt's not finding the function it is looking for in that library.
This is what confuses me, the
instructions say install the Solaris version of comm
api (http://www.rxtx.org/ how-to said Solaris Sparc
and the rxtx INSTALL file said Solaris x86 so I tried
both in turn and neither worked) Same here after downloading the latest stuff to my x86 Linux box. I received a similar UnsatisfiedLinkError. I checked the shared libraries and the functions were not in it.
normally these would
call the Solaris binary drivers but I assume this has
to be redirected to rxtx which calls its own
binaries?Yes. There is a part of RXTX called JCL (Java Comm for Linux) that handles that.
http://www.geeksville.com/~kevinh/linuxcomm.html
However, I think the problem is that Sun's API has changed since the RXTX How-To was written. Try downloading the 'comm.jar' at the bottom of the page. It says:
comm.jar, 2.0.3, generic, English (3rd party backward compatibility, only), EnglishUnzip it and copy the comm.jar file to the 'jre/lib/ext' folder of the JDK/JVM where everything else RXTX created was placed.
After doing this the SerialDemo app started for me without errors.
Jim S. -
Need some help on JAVA COMM API's
Hi all,
I am working on Java for first time,,and I am working on serial interface ,I need some documentation of JAVA COMM API's ,Please forward some linksHave you read any of these?
http://search.java.sun.com/search/java/index.jsp?qp=&nh=10&qt=%2B%22chat+server%22&col=javaforums -
I am trying to use the Java Comm API with Windows 2000 and I can enumerate the ports (I am almost sure that the problem is the dll). Do anybody knows a solution?
Where is the problem?
-
Help...problems using java comm API
Hi all
im using Fedora Core and in order to list all the available serial ports for my computer i'm using the classic program TestEnumeration, but when running from jbuilder 2005 not from shell i received the following errors:
Error loading SolarisSerial: java.lang.UnsatisfiedLinkError: no SolarisSerialParallel in java.library.path
Caught java.lang.UnsatisfiedLinkError: readRegistrySerial while loading driver com.sun.comm.SolarisDriver
Error loading SolarisSerial: java.lang.UnsatisfiedLinkError: no SolarisSerialParallel in java.library.path
Caught java.lang.UnsatisfiedLinkError: readRegistrySerial while loading driver com.sun.comm.SolarisDriver
warning: no ports found - make sure javax.comm.properties file is found
i have followed all the instruction to install comm API but i received the same error i need help plz if someone can
thximport java.io.*;
import java.util.*;
import javax.comm.*;
import java.lang.*;
import java.Buff.*;
public class SimpleRead implements Runnable, SerialPortEventListener
static CommPortIdentifier portId;
static Enumeration portList;
InputStream inputStream;
SerialPort serialPort;
Thread readThread;
public static void main(String[] args)
{//System.out.println("hello");
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)
System.out.println(e);
try
inputStream = serialPort.getInputStream();
catch (IOException e)
System.out.println(e);
try
serialPort.addEventListener(this);
catch (TooManyListenersException e)
System.out.println(e);
serialPort.notifyOnDataAvailable(true);
try
serialPort.setSerialPortParams(9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
catch (UnsupportedCommOperationException e)
System.out.println(e);
try {
out = new OutputStreamWriter(serialPort.getOutputStream());
out.write("ATQ0V1E0");
out.flush();
out.write("ATQ0V1E0");
Out.close();
//System.out.println("ATQ0V1E0");
catch (IOException e) {}
try {
int line;
int result ;
InputStream = serialPort.getInputStream();
int num= inputStream.available();
InputStreamReader reader = new InputStreamReader(inputStream);
System.out.println(reader.ready());
while ((line = reader.read()) <= 0)
result =reader.read();
System.out.println("Success " + result);
reader.close();
catch (IOException e) {}
readThread = new Thread(this);
readThread.start();
try {
OutputStream = SerialPort.getOutputStream();
catch (IOException e) {}
System.out.println("ATQ0V1E0");
public void run()
try
Thread.sleep(500);
catch (InterruptedException e)
System.out.println(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)
System.out.println(e);
break;
hi friends am getting these errors
C:\programs>javac SimpleRead.java
SimpleRead.java:115: illegal start of expression
public void run()
^
SimpleRead.java:159: ';' expected
^
2 errors
please help me....
its very urgent....this is the first program of mine.... am so tensed..
i should finish this soon... please help me...
this is my mail ID
[email protected] -
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
arvindi cant run the program in j2sdk1.4
port is not opening.
iam using comm.jar,javax.comm.properties ,win32 dll -
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?
-
How to use java comm API in 64 bit javn on solaris 10
hi,
I want to connect to a device through serial port on sparc Solaris 10 in 64-Bit JVM, but i cannot find the correct API for that, i have tried using RXTX but it has many issues.
I noticed SUNWjcomx package is removed in Solaris 10.
Please some one helphi,
I want to connect to a device through serial port on sparc Solaris 10 in 64-Bit JVM, but i cannot find the correct API for that, i have tried using RXTX but it has many issues.
I noticed SUNWjcomx package is removed in Solaris 10.
Please some one help -
Java COMM API, notifyOnBreakInterrupt
Hello,
What does the method "notifyOnBreakInterrupt" mean exactly?
It says that -
Expresses interest in receiving notification when there is a break interrupt on the line.
What is a break interrupt on a line?
Thank You !!
MayurA break interrupt is a special signal that can be sent over a serial connection. (Technically it is done by setting the line to a certain voltage for a certain period of time, I think, but you and I don't need to deal with that sort of detail.) It is often used in serial communication to signal the end of the session, or some exceptional condition. If whatever is sending data to you uses breaks, its documentation should tell you so.
-
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
MMNTry 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- -
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.
Maybe you are looking for
-
Problem with mac mini 2012 connection
Hello!I have a problem with my mac mini 2012 connection!The hdmi to hdmi connection working great at my mac mini!The thunderbolt(mac mini) to hdmi (display) is not working!But when i have the hdmi to hdmi cable and the thunderbolt to hdmi at the same
-
How to get object/instance name in method
Hi folks, I have created a class and implemented a method within the class. Now i would like get the name of instance/object calling this method ,within this method. Is their any way to get this obj name within method? Eg: I hve class ZCL with method
-
An Acrobat 11 system update was running and did not complete. What is wrong?
When I opened a PDF file. A message indicated an Error: 1 had occurred and to uninstall and re-install Acrobat 11. I uninstalled, but the reinstall will not complete. What is wrong?
-
Constantly getting publishing errors in iWeb
Has any one else experienced publishing errors when trying to publish to your ,mac account?
-
XE installation problem due to broken old XE services in Windows
My windows XP Home edition has old broken XE services - 5 in number. Corresponding data files and uninstaller on disk are absent. Windows program removal does not give me an option. Have tried practically all normal options in windows to remove these