Here's how I (AdrianBowyer) did it: Go to =43208d3dand go to the download link at the bottom of the page. You will need to register with Sun to get there, but it's free. Download the file comm3.0_u1_linux.zip. There are four files you need from the unzip of that:
Put the jar file somewhere in your class path (e.g. somewhere like usr/java/j2sdk/jre/lib/ext), the .so files in java's load-library path (on my system that's in /usr/java/j2sdk/jre/lib/i386), and javax.comm.properties "somewhere that java can find it" - on my system, that seems to mean creating a symbolic link to it from the directory in which you're running the project, but there must be an easier way.
Win32com Dll Javax Comm Properties Comm Jar
The jar file still needs to be put in your Java class path. This is an environment variable called CLASSPATH, and you can add things on to it - or create it if it is not there. You do this by typing export CLASSPATH=$CLASSPATH:/my/new/library/path/blah. To let the Java serial library find javax.comm.properties, put its path in the class path too. This can all be added to your profile file, typically /.bashrc or entered in the "Run" configuration in Eclipse.
WARNING There are comm.jar files out there that do not support the Linux drivers. If in doubt, unzip the comm.jar file (yes, JAR files are really ZIP files) and see if the file ./com/sun/comm/LinuxDriver.class exists. If it doesn't, download a new Linux JavaComm as above.
[-javax.comm.properties-] should be copied to the following directories:%JAVA_HOME%/lib == C:\Program Files\Java\jdk1.5.0_10\lib%JAVA_HOME%/jre/lib == C:\Program Files\Java\jdk1.5.0_10\jre\lib
actually, I found it. In some of the previous comments was said that you should place files in ...jdk... folder. But when you open a project, check for the path of the already added libraries(below the package folder in solution explorer).
A: We do not provide a linux implementation. But Kevin Hester has written Java communications API drivers for linux and uses our CommPort driver loading scheme to load his own gnu.io.RXTXCommDriver class. He gave us permission to disclose his web page:
I am trying to do it with comm.jar(your win version but for linux). You know, that gnu.io.* got the same functions as your javax.comm. Is it posible to findit for linux. Just that properties. In properties, there is a win32 and so... But, it is not so important for me to work with javax.comm, I am a biginner. :)
However, from the error you posted, it seems that you java compiler can not access the library to identify the ports on your machine. I suggest doing the following:1. search Google, use keyword: java.lang.NoClassDefFoundError: javax/comm/CommPortIdentifier
Caught java.lang.ClassNotFoundException: com.sun.comm.Win32Driver while loadingdriver com.sun.comm.Win32DriverError loading SolarisSerial: java.lang.UnsatisfiedLinkError: no SolarisSerialParallel in java.library.pathCaught java.lang.UnsatisfiedLinkError: com.sun.comm.SolarisDriver.readRegistrySerial(Ljava/util/Vector;Ljava/lang/String;)I while loading driver com.sun.comm.SolarisDriver
Caught java.lang.ClassNotFoundException: com.sun.comm.Win32Driver while loading driver com.sun.comm.Win32DriverError loading SolarisSerial: java.lang.UnsatisfiedLinkError: no SolarisSerialParallel in java.library.pathCaught java.lang.UnsatisfiedLinkError: readRegistrySerial while loading driver com.sun.comm.SolarisDriver
example:google keyword search: Caught java.lang.ClassNotFoundException: com.sun.comm.Win32Driver while loading driver com.sun.comm.Win32DriverCaught java.lang.ClassNotFoundException: com.sun.comm.Win32Driver while loading driver com.sun.comm.Win32Driver
3. the error NoSuchPortException means that the port identifier such as COM1 or COM4 does not exist in your system or it is not accessible. you could try to use the following command:CommPortIdentifier.getPortIdentifiers() to get the ports registered in your system.again you could search google using the search word: NoSuchPortException.
1. first line of errors says that COM4 is being used by Unknow windows Application. before you run your java appley, you need to close any software that uses COM42. if you look through the comments on this post you will notice couple of codes samples. you should be able to tailor them to your needs.
To establish a connection with the TL1 device, click the Open Session button from the Session menu or from the toolbar. The Open Session dialog is displayed as shown in the figure. Select the transport protocol such as TCP, Telnet, or Serial to communicate with the TL1 device and specify the connection properties. For example, you must specify the host and port in the case of TCP.
I recommend the old 1.1.8 version because it's smaller and fasterthan the latest versions and it runs perfectly well. So theinstructions that follow will assume you're taking my suggestion andusing this obsolete, but eminently functional, version of Java. Youare of course free to download and install the latest-and-greatest,but then you'll have to adapt the instructions accordingly on yourown.
javax.comm is the name of the standard libraries createdby Sun for interacting with a serial port from the Java language. Ihave created a tiny zip download that has precisely the threenecessary files and an installer batch file for putting them in theright place.Download the javax.comm forJDK118 zip file and extract it into a temporary directory. Therewill be three files and an installer batch file namedinstall-JDK118.bat. Run the batch file (double-click onit), and the following files will be copied to the followingdirectories:win32com.dll to C:\JDK1.1.8\BIN\comm.jar to C:\JDK1.1.8\LIB\javax.comm.properties to C:\JDK1.1.8\LIB\After the installer runs, check that the three files are indeed intheir specified locations.
Now you need to tell your PC where the Java binaries are located(they're in C:\JDK1.1.8\BIN\). Also, you need to create anenvironment variable named CLASSPATH that tells the Javasoftware about the new comm.jar communicationslibrary.
Then you'll want to create a CLASSPATH environmentvariable. Click the New button, type CLASSPATH into thename field, and set its value to be:.;C:\JDK1.1.8\LIB\COMM.JARNote the initial period, then a semicolon, followed by thelocation of the communications .jar file.
Now boot up a DOS shell (Start Menu:Run and type cmd or,if, on an older Windows machine, type command). At the shell,type java . If you see a bunch of text starting withusage: java [-options] class etc. then you're all set.Running BeepTest to Discover Serial PortsLet's run the HC11Boot.java program. At the command shell, type:java BeepTestPlease note that you must follow the capitalizationBeepTest exactly.
To see if you should have available serial ports, please run thestandard communications package HyperTerminal (it may alreadybe on your machine; check Start Menu->Accessories->Communications).See if it presents you with any serial ports to connect to. If yes,then it's likely a javax.comm setup problem—skip to the nextparagraph. If HyperTerminal did not give you any COM portchoices, then you likely have a lower-level serial driver problem.This would be beyond the scope of this document, but resolutiongenerally involves a trip to the Device Manager in Windows' SystemControl Panel, and in extreme cases, change to your CMOS machineconfiguration.
Check which version of Java you are calling up by typing justjava -version at the prompt. If you don't get 1.1.8, thenyou're running some other version of Java, which won't have thejavax.comm extensions installed properly. Try giving the full path tothe 1.1.8 java binary; type \jdk1.1.8\bin\java BeepTest.Notes for Non-Windows OSesThe only special trick for running on non-Windows OS'es is findinga replacement for the javax.comm libraries.
There is an open-source initiative located at for makingreplacement javax.comm-compatible drivers for lots of different OS'es.From this site, download, configure, and install the rxtx driversappropriate for the OS you are running.
As mentioned previously, to develop the server-side code to interface with a GSM modem, I used the open source SMSLib for Java, which uses attention commands (AT commands) to interface with a GSM modem. It also uses either the Java Communications API or RxTx to communicate with the underlying operating system and talk with the external device (GSM modem) to send the AT commands.
To start with Java Communications API 2.0, first, make sure you have installed the API correctly. Unzip the javacomm20-win32.zip. Inside the subdirectory commapi, you will find the following files, which are of interest:
Copy the javax.comm.properties to your Java Runtime Environment's lib directory. Copy the win32com.dll to your JRE's bin directory. While running any program using SMSLib, make sure that comm.jar is in the classpath.
To ensure the Java Communications API has been installed properly, go to the commapi\samples\BlackBox directory from the command prompt. Set the PATH variable as follows: For my case, the JRE home is C:\j2sdk1.4.2_03\jre. Change this according to your JRE settings. Set PATH=.;C:\j2sdk1.4.2_03\jre\bin;. Now execute the Java BlackBox program using the following command: java -classpath .;../../comm.jar;BlackBox.jar; BlackBox.
If the Java Communications API has been installed properly, then a Swing window, shown in Figure 15, will appear with your machine's available serial ports (COM ports). After closing the window, the command prompt will contain some lines related to the available COM ports, as shown in the sample command prompt output below. Remember that this Swing window content and the command prompt content will vary depending on the available ports in your PC; the output will not be same as mentioned here. But the important point is, if you are able to see the GUI and the lines in the command prompt (like the following), you can assume that the Java Communications API has been installed properly. After this test, close the Swing window to terminate the BlackBox program. 2ff7e9595c
Comments