Java Serial Tools

Java Serial Tools is an open source GUI application that can read and log serial data to various formats

It is based on jSerialComm library with a graphical interface added on top and a lot of options.

How to use Java Serial Tools

Java Serial Tools is shipped with some defaults:

  • uses new line character to separate lines
  • writes output to the console

If you want to run a short test, download the jar file, and run it from command line. Connect your computer to a serial device that generates log entries, and then, from Java Serial Tools connect to that COM port. You should see the received data in the console.

Make sure you have installed Java Runtime Environment on your computer.

You can use an Arduino to generate serial data :

int counter = 0;
void setup() {
  // https://www.arduino.cc/reference/en/language/functions/communication/serial/begin/
  Serial.begin(9600, SERIAL_8N1);
}

void loop() {
  Serial.print("NEW LINE ");
  Serial.println(counter);
  counter ++;
  delay(5000);
}

Default options:

By default it splits the lines by newline “\n” character and the output is sent to the console.

Changing the line delimiter

You can create custom delimiters and use a separate delimiter for each port.

Open the project with the preferred IDE and then edit the src/main/java/ro/paha/ serialtools/view/ArduinoSerial.java file and change the “messageSeparator” object to another line separator.

Because this app is based on jSerialComm , you can create delimiters that splits lines by words.  New delimiters can be created in  src/main/java/ro/paha/serialtools/delimiter folder.

Changing the output format

The output formats are defined in src/main/java/ro/paha/serialtools/repository folder.

If you want to log the data  into a mysql database,  modify the src/main/resource/db.properties file with your database user and password, and then update the  src/main/java/ro/paha/ serialtools/view/ArduinoSerial.java file and change the “repo” object to “Database”.

After you change the source code, proceed to the build jar section in this article.

How to build the jar file

Install IntelliJ and import the project:

Copy the project by downloading from Github or clone it by git:
git clone https://github.com/floringavrila/serialtools

Open IntelliJ and choose import project and then select the downloaded folder.

In the next window choose Gradle and in the next one choose “Use auto-import” and then click on “Finish”.

Activate the graddle window in IntelliJ (View->Tool Windows->Gradle), expand the “Tasks->build” group and then double click the “jar” task.

The jar can be found in build/libs/ folder

You can open the jar by double click or from command line.