-
Notifications
You must be signed in to change notification settings - Fork 288
Installation
One of the most convenient features of this library is that it allows you to simply include the JAR file in your custom project, and it will automatically select and load the correct native library for your platform and architecture. As such, you can make use of this library by simply copying the jSerialComm.jar file into your project directory and linking to it as you would any other JAR file.
To access the contents of the library in your project, make sure to import com.fazecast.jSerialComm.*
into your java files. You can then generate a list of all available serial ports on your system (real or virtual), by calling the following static method:
SerialPort.getCommPorts()
This will return an array of SerialPort
objects through which you can iterate. See the Javadoc files under [Javadoc Library Reference] for a complete overview of this library and its methods.
Note for Linux users: Serial port access is limited to certain users and groups in Linux. To enable user access, you must open a terminal and enter the following commands before jSerialComm will be able to access the ports on your system. (Note, this must only be done once for each user):
-
sudo usermod -a -G uucp
username -
sudo usermod -a -G dialout
username
Replace the username parameter with your current username. (If you are not sure what your username is, type whoami
and it will tell you.) If you are using SUSE 11.3 or higher, replace the '-a -G' flags with a single '-A' flag. Log out and you should have access to the serial port after logging back in.
####Import Using an Automated Build System####
Instead of manually copying the jSerialComm.jar file into your own project, you can automatically add it as a dependency from the Maven Central Repository. Use one of the following dependency declarations depending on the build system you are using:
#####Maven#####
<dependency>
<groupId>com.fazecast.jSerialComm</groupId>
<artifactId>jSerialComm</artifactId>
<version>1.0.0</version>
</dependency>
#####Ivy#####
<dependency org="com.fazecast.jSerialComm" name="jSerialComm" rev="1.0.0"/>
#####Grape#####
@Grapes(
@Grab(group='com.fazecast.jSerialComm', module='jSerialComm', version='1.0.0')
)
#####Gradle#####
'com.fazecast.jSerialComm:jSerialComm:1.0.0'
#####Buildr#####
'com.fazecast.jSerialComm:jSerialComm:jar:1.0.0'
#####SBT#####
libraryDependencies += "com.fazecast.jSerialComm" % "jSerialComm" % "1.0.0"
#####Leiningen#####
[com.fazecast.jSerialComm/jSerialComm "1.0.0"]
Copyright © 2012-2024 Fazecast, Inc. All rights reserved.