----------
BUILDING
----------
Building this library yourself is not advised (at least not for distribution) since it requires native compilation across multiple platforms. It is recommended to simply use the pre-built jSerialComm library in your application. For installation/usage instructions, please skip ahead to the "USAGE" section.
If you do choose to build this library for your specific system, the recommended methodology is to use Gradle coupled with the Java SDK, version 1.6 (for backward compatibility).
Java SDK 1.6 can be downloaded from http://www.oracle.com/technetwork/java/archive-139210.html
Gradle can be downloaded from https://gradle.org/
Once the Java SDK 1.6 has been installed, ensure that you have an environment variable called JDK_HOME set to the base directory of your JDK installation. Once this has been done, refer to the section corresponding to your specific Operating System for further instructions.
Please note, if you would like to edit any of the source code or view it in an IDE (such as Eclipse), you can automatically build the Eclipse project files by entering the following on a command line or terminal from the base directory of this project (.../jSerialComm/): gradle eclipse
You can then Import the project using the "Existing Project into Workspace" import tool in Eclipse. (Note that if you use Eclipse as an IDE, you will probably want to install the Eclipse CDT plugin for proper handling of the C/C++ source code)
------------
LINUX/UNIX
------------
Ensure that the following tools are installed on your Linux distribution: g++ make glibc-devel.x86_64 glibc-devel.i686 libstdc++-devel.x86_64 libstdc++-devel.i686 (on some distros, these may be called multilib tools for gcc and binutils)
Ensure that the JDK_HOME environment variable has been set for the 1.6 version of your Java SDK. The correct directory can usually be found by entering the following command: readlink -f /usr/bin/java
Export the result of this command UP TO BUT NOT INCLUDING the /jre/... portion using the 'export' command. For example, if 'readlink' 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
Change directories to the following project directory: ".../jSerialComm/src/main/cpp/Linux/"
Run the following commands in order:
make
cd ../../../..
gradle build
The resulting jSerialComm library can be found in the project directory ".../jSerialComm/build/libs/" under the name "jSerialComm-{VERSION}.jar"
-------------------------------------
ARM-BASED MOBILE LINUX (NON-ANDROID)
-------------------------------------
Ensure that you have a cross-compiler installed on your Linux distribution capable of compiling for ARM-based architectures. I prefer crosstool-ng for this purpose.
Ensure that the JDK_HOME environment variable has been set for the 1.6 version of your Java SDK. The correct directory can usually be found by entering the following command: readlink -f /usr/bin/java
Export the result of this command UP TO BUT NOT INCLUDING the /jre/... portion using the 'export' command. For example, if 'readlink' 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
Change directories to the following project directory: ".../jSerialComm/src/main/cpp/Linux/"
Run the following commands in order:
make arm
cd ../../../..
gradle build
The resulting jSerialComm library can be found in the project directory ".../jSerialComm/build/libs/" under the name "jSerialComm-{VERSION}.jar"
----------
MAC OS X
----------
Ensure that Xcode is installed on your system. If it is not, it can be downloaded via the App Store. You must also make sure that the Xcode Command Line Tools are installed. This can be done by entering the following command in a terminal: xcode-select --install
Change directories to the following project directory: ".../jSerialComm/src/main/cpp/OSX/"
Run the following commands in order:
make
cd ../../../..
gradle build
The resulting jSerialComm library can be found in the project directory ".../jSerialComm/build/libs/" under the name "jSerialComm-{VERSION}.jar"
---------
WINDOWS
---------
Ensure that the Visual Studio C++ Compiler is installed on your system. If it is not, you can download a free version (Visual C++ 2010 Express) from https://www.visualstudio.com/downloads/download-visual-studio-vs.
Open up a command prompt (Run->'cmd') and change to the following project directory: "...\jSerialComm\src\main\cpp\Windows\"
On Windows, the Visual Studio Compiler must be configured to build either 32- or 64-bit binaries but never both at the same time. Therefore, you will have to build binaries for the two architectures separately.
For the following commands, {VC_DIRECTORY} is the installation directory of your Visual Studio C++ Compiler (for example: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC). Run the following commands in order:
{VC_DIRECTORY}\vcvarsall.bat x64
nmake win64
{VC_DIRECTORY}\vcvarsall.bat x86
nmake win32
cd ..\..\..\..
gradle build
The resulting jSerialComm library can be found in the project directory "...\jSerialComm\build\libs\" under the name "jSerialComm-{VERSION}.jar"
-------
USAGE
-------
In order to use the jSerialComm library in your own project, you must simply include the jSerialComm JAR file in your build path and import it like any other java package using "import com.fazecast.jSerialComm.*;"
Alternatively, you can automatically add jSerialComm to your project as a dependency from the Maven Central Repository. Use the following dependency declaration depending on your build system:
Maven:
com.fazecast
jSerialComm
1.2.2
Ivy:
Grape:
@Grapes(
@Grab(group='com.fazecast', module='jSerialComm', version='1.2.2')
)
Gradle:
'com.fazecast:jSerialComm:1.2.2'
Buildr:
'com.fazecast:jSerialComm:jar:1.2.2'
SBT:
libraryDependencies += "com.fazecast" % "jSerialComm" % "1.2.2"
Leiningen:
[com.fazecast/jSerialComm "1.2.2"]