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.
Similar Messages
-
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?
OliverHi
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 -
COMM Api problems to send a CR (13 or ^M) character.
I am trying to get familiar with the COMM API, I use the examples in the package like "BlackBox", or "SerialDemo".
They work fine, but I realized there is no way to send an "enter" to my router I am trying for testing the COM.
With any other term program on my COM1 I have no problems, both with standard ASCII characters, and with any control character (0-32), thus including "enter" (CR, 13, ^M are equivalents as far as I know).When trying to send ASCII characters, make sure that you don't send a String, as Java strings are Unicode characters consisting of two bytes. Standard ASCII uses the bottom 7-bits of a byte. The send an Enter or Return chararcter, use the primative type: char
char myEnterChar = '\r';Cheers,
- David -
Hi Everyone,
I've just installed the comm API, and installation process seems to have gone quite smoothly, (the code is compilling correctly), but the demo programs will not run, i get the error:
Exception in thread "main" java.lang.NoClassDefFoundError: SimpleWrite
or the same error coming from SimpleRead.
Any ideas on whats going on?
AndrewYou can't use directory names that have a space in
them when using Java.Okay, I've uninstalled the java sdk, installed it to
C:\jdk
copied the win32.dll to the jdk\bin directory
and the properties and comm.jar file to the jdk\lib directory
reset the classpath using
set CLASSPATH=c:\jdk\lib\comm.jar
and it's still not working, any other suggestions? -
Comm API problems (getPortIdentifier)
Hi! I wrote an applet that uses the javax.comm API to manage a serial port in the host machine. When first develop it with JDK 1.1.8 the applet (and an application) runs perfectly. I now have Java 2 (jdk1.3.1._02) and I'm trying to run this applet and when it arrives to a CommPortIdentifier.getPortIdentifier(String) call, I got this message:
"java.io.lang: name can't be null"
First I thought that was my applet, that my application was wrong, so I try to use de SerialDemo example that comes with the javax.comm and It doesn't work either! If I run it with the latest beta version of JDK (1.4 I think) it runs again... any idea???
Thanks a lot! =)in jdk1.3...
u have to copy the win32com.dll and comm.properties file in the jre\1.3\bin folder of the machine
and comm.jar in the jre\1.3\lib folder....
remember, in windows, u will get the
...\program files\javasoft\jre\1.3\lib or ..\bin
ther u have to store not in ur c:\jdk1.3\bin
Regards,
Ritesh -
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. -
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] -
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? -
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. -
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 -
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
-
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 -
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!
Maybe you are looking for
-
I just purchased a new PC with Windows 8 installed. I cannot see my Time Capsule when I use Airport. I use the Time Capsule for my internet access and wireless connection without any problem.
-
i need to get th answers to my security questions
-
Windows 10 download link not working
Hi, I tried to download the windows 10 technical preview iso file and every time the downloaded file is only 13kb. Is there something wrong with the download link? Regards, Zehan
-
Error message always showing up when i connect to ...
My Nokia asha 302 does not connect to the INTERNET . The Nokia Browser would always show the error message; Page proxy authentication required. Everything stops there. Please help me to resolve this issue. Thank you.
-
No one can use my forms. What's the deal?