Java Serial Port

 

World's Best SerialPort Java Developer Tool (since 1996) - World's First Commercial Java Serial Port API Not sure which package to get? SerialMagic is the leading keyboard wedge application for SPP and BLE compatible scanners. SerialPort is the world's first, and still foremost Java product for serial ports. SerialPort provides highly flexible control of serial ports from your Java application.SerialPort is a high-performance class that also provides low-level serial port control. Dec 02, 2001  When I send ' from Java program to the controller through serial port, the Java program is receiving correct controller response, but once in Manual Mode when I send '1' from the same Java program, the robot does not move. Mar 07, 2019  jSerialComm. A platform-independent serial port access library for Java. For usage examples, please refer to the Usage wiki. In order to use the jSerialComm library in your own project, you must simply include the JAR file in your build path and import it like any other Java package using import com.fazecast.jSerialComm.

The code can iterate through each element inside the Enumeration and determine whether or not it is a serial port. The method getPortType can identify what kind of port it is. If it is a serial port, then the code will add its name to a combo box in the GUI (so that users can pick what port to connect to). Serial Port Notifier (formerly Serial Port Monitor) sits in your notification tray and monitors the serial ports on your computer. When a port is added or removed, a notification is shown containing the port's COM port name, allowing you to easily keep track of what's been plugged in and out.

A platform-independent serial port access library for Java.

Usage

For usage examples, please refer to the Usage wiki.

In order to use the jSerialComm library in your own project, you must simplyinclude the JAR file in your build path and import it like any otherJava package using import com.fazecast.jSerialComm.*;.

Alternatively, you can automatically add jSerialComm to your project as adependency from the Maven Central Repository. Use the following dependencydeclaration depending on your build system:

  • Maven:
  • Ivy:
  • Groovy:
  • Gradle:
  • Buildr:
  • Scala/SBT:
  • Leiningen:

Troubleshooting

If you are using Linux and this library does not appear to be working, ensurethat you have the correct permissions set to access the serial port on your system.One way to test this is to run your application as root or by using thesudo command. If everything works, you will need to either run yourapplication as root in the future or fix the permissions on your system.For further instructions, refer to the Troubleshooting wiki.

On some very few systems which use custom ARM-based CPUs and/or have extremelyrestrictive permissions, the library may be unable to determine that theunderlying system architecture is ARM. In this case, you can force thelibrary to disable its auto-detect functionality and instead directly specifythe architecture using the Java os.arch_full system property. Acceptablevalues for this property are currently one of: armv5, armv6,armv6-hf, armv7, armv7-hf, armv8_32, armv8_64,x86, or x86_64.

An additional note for Linux users: If you are operating this library inevent-based mode, the LISTENING_EVENT_DATA_WRITTEN event will never occur.This is not a bug, but rather a limitation of the Linux operating system.

Java

For other troubleshooting issues, please see if you can find an answer in eitherthe Usage-Examples wikior the Troubleshooting Wiki.

If your question is still not answered, feel free to open an issue report onthis project's GitHub page,and we will be glad to look into it.

Building

Building this library yourself is not advised (at least not for distribution)since it requires native compilation across multiple platforms. It isrecommended to simply use the pre-built jSerialComm library in yourapplication. For installation/usage instructions, please skip to the usage section.

If you do choose to build this library for your specific system, the recommendedmethodology is to use Gradle coupled with theJava SDK, version 1.6(for backward compatibility).

Once the Java SDK 1.6 has been installed, ensure that you have an environmentvariable called JDK_HOME set to the base directory of your JDK installation.Once this has been done, refer to the section corresponding to your specificOperating System for further instructions.

Please note, if you would like to edit any of the source code or view it in anIDE (such as Eclipse), you can automatically build the Eclipse project files byentering the following on a command line or terminal from the base directory ofthis project:

You can then Import the project using the 'Existing Project into Workspace' importtool in Eclipse. (Note that if you use Eclipse as an IDE, you will probably wantto install the Eclipse CDT plugin for proper handling of the C source code).

Linux/UNIX

Ensure that the following tools are installed on your Linux distribution:

Ensure that the JDK_HOME environment variable has been set for the 1.6version of your Java SDK. The correct directory can usually be found by enteringthe following command:

Export the result of this command up to but not including the/jre/.. portion using the export command. For example, ifreadlink produced /usr/lib/jvm/java-6-jdk/jre/bin/java as an output,the export command would look like: export JDK_HOME=/usr/lib/jvm/java-6-jdk

Run the following commands:

The resulting jSerialComm library can be found in the project directorybuild/libs under the name jSerialComm-{VERSION}.jar.

Solaris

Ensure that you have a cross-compiler installed on your Linux distributioncapable of compiling for both x86 and Sparc-based Solaris architectures.Instructions for creating such a toolchain can be found on theSolaris Cross-Compiler wiki.

Ensure that the JDK_HOME environment variable has been set for the 1.6version of your Java SDK. The correct directory can usually be found by enteringthe following command:

Export the result of this command up to but not including the/jre/.. portion using the export command. For example, ifreadlink produced /usr/lib/jvm/java-6-jdk/jre/bin/java as an output,the export command would look like: export JDK_HOME=/usr/lib/jvm/java-6-jdk

Run the following commands:

Java Serial Port

The resulting jSerialComm library can be found in the project directorybuild/libs under the name jSerialComm-{VERSION}.jar.

ARM-Based Mobile Linux (non-Android)

Java Serial Port Api

Ensure that you have a cross-compiler installed on your Linux distributioncapable of compiling for ARM-based architectures. I prefer crosstool-ngfor this purpose.

Ensure that the JDK_HOME environment variable has been set for the 1.6version of your Java SDK. The correct directory can usually be found by enteringthe following command:

Export the result of this command up to but not including the/jre/.. portion using the export command. For example, ifreadlink produced /usr/lib/jvm/java-6-jdk/jre/bin/java as an output,the export command would look like: export JDK_HOME=/usr/lib/jvm/java-6-jdk

Run the following commands:

Java Connect To Serial Port

The resulting jSerialComm library can be found in the project directorybuild/libs under the name jSerialComm-{VERSION}.jar.

Android

Ensure that the Android NDK is installed on your system. For purposes of theseinstructions, assume that it is installed at {NDK_HOME}.

Run the following commands in order:

The resulting jSerialComm library can be found in the project directorybuild/libs under the name jSerialComm-{VERSION}.jar

Mac OS X

Java Serial Port Library

Ensure that Xcode is installed on your system.If it is not, it can be downloaded via the App Store. You must also make surethat the Xcode Command Line Tools are installed. This can be done byentering the following command in a terminal: xcode-select --install

Run the following commands in order:

The resulting jSerialComm library can be found in the project directorybuild/libs under the name jSerialComm-{VERSION}.jar

Windows

Ensure that the Visual Studio C++ Compiler isinstalled on your system.

On Windows, the Visual Studio Compiler must be configured to build either32- or 64-bit binaries but never both at the same time. Therefore, you will haveto build binaries for the two architectures separately.

Open a command prompt and run the following command:

where [version] matches the version of the Visual Studio C++ Compilerthat is installed.

Then run:

The resulting jSerialComm library can be found in the project directorybuild/libs under the name jSerialComm-{VERSION}.jar

Java Serial Port Example Linux



The Java Communications 3.0 API is a Java extension that facilitates developing platform-independent communications applications for technologies such as Smart Cards, embedded systems, and point-of-sale devices, financial services devices, fax, modems, display terminals, and robotic equipment.

The Java Communications API (also known as javax.comm) provides applications access to RS-232 hardware (serial ports) and limited access to IEEE-1284 (parallel ports), SPP mode.

Implementations of the API are currently available for Solaris SPARC, Solaris x86, and Linux x86. Each of Oracle's available implementations works with the Sun Ray thin client product line, and include portmapping extensions to allow an administer to specify the locations of ports as well as their visibility, names, and in some cases annotated reference.


API serial features:

  • Enumeration of ports (administrator and user configurable port mapping)
  • Port configuration (baud rate, speed, stop bits, parity)
  • Access to EIA232 standard DTR, CD, CTS, RTS and DSR signals
  • Transfer of data over RS-232 ports
  • Hardware and software flow-control options
  • Receive-buffer threshold control
  • Asynchronous event option for notification of:
    • Data available on an RS-232 port
    • Port hardware line level changes
    • Port ownership changes within a single JVM

Java communications API was initially released in 1997, prior to the Java Community Process, was 'grandfathered in' to the JCP (http://www.jcp.org) without having an associated JSR (Java Specification Request).


Windows Full Specifications What's new in version 3.0.4This version is a point update to 3.0 and contains bugfixes and updates packages, some of which are high priority.GeneralPublisherPublisher web siteRelease DateNovember 28, 2017Date AddedJanuary 10, 2019Version3.0.4CategoryCategorySubcategoryOperating SystemsOperating SystemsWindows NT/2000/XP/Vista/7/8/10Additional RequirementsNoneDownload InformationFile Size38.29MBFile Namefpc-3.0.4.i386-win32.exePopularityTotal Downloads343,408Downloads Last Week187PricingLicense ModelFreeLimitationsNot availablePriceFree.