javaserial-portinputstreamrxtx

Java COM port listening with RxTx EXCEPTION_ACCESS_VIOLATION


I'm trying to write a java program to read data from a certain COM port (COM3). As a side note: data is sent from a raspberry pi to an XBee. The XBee sends it to another XBee which is connected with a laptop via usb.

I'm using the java RxTx library to listen to the COM port. The program works fine, but crashes on line 97:

int numBytes = inputStream.read(readBuffer);

Line 95 & 96 are working properly and it prints the correct number of bytes send (if I comment line 97):

try {
    while (inputStream.available() > 0) {
        System.out.println("Number of bytes in inputstream = " + inputStream.available() + ".");

However if I uncomment line 97, the program crashes immediatally when data is being send. It gives me: "EXCEPTION_ACCES_VIOLATION (0xc0000005) at pc=0x0000000180005b00, pid=15436, tid=4052." And it generates an error report. I included the error report under the java code.

The java code:

import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
import gnu.io.SerialPortEvent;
import gnu.io.SerialPortEventListener;
import gnu.io.UnsupportedCommOperationException;

import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.TooManyListenersException;

public class SerialPortDataRead implements Runnable, SerialPortEventListener {
    static CommPortIdentifier portId;
    static Enumeration portList;

    InputStream inputStream;
    SerialPort serialPort;
    Thread readThread;

    public static void main(String[] args) {
        portList = CommPortIdentifier.getPortIdentifiers();

        while (portList.hasMoreElements()) {
            portId = (CommPortIdentifier) portList.nextElement();
            if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
                if (portId.getName().equals("COM3")) {
                    System.out.println("\nportId.getName() == COM3. Trying to make connection...\n");
                    SerialPortDataRead reader = new SerialPortDataRead();
                }
            }
        }
    }

    public SerialPortDataRead() {
        try {
            serialPort = (SerialPort) portId.open("SimpleReadApp", 2000);
            System.out.println("Port 'COM3' is opened!");
        } catch (gnu.io.PortInUseException e) {System.out.println(e);}
        try {
            inputStream = serialPort.getInputStream();
            System.out.println("Receiving input stream...");
        } catch (IOException e) {System.out.println(e);}
        try {
            serialPort.addEventListener(this);
            System.out.println("Listening for events on port 'COM3'...");
        } catch (TooManyListenersException e) {System.out.println(e);}
        serialPort.notifyOnDataAvailable(true);
        try {
            serialPort.setSerialPortParams(9600,
                    SerialPort.DATABITS_8,
                    SerialPort.STOPBITS_1,
                    SerialPort.PARITY_NONE);
            System.out.println("Port parameters for 'COM3' are set!");
        } catch (UnsupportedCommOperationException e) {System.out.println(e);}
        readThread = new Thread(this);
        System.out.println("New thread created (readThread).");
        readThread.start();
        System.out.println("New thread started (readThread).");
    }

    @Override
    public void run() {
        try {
            Thread.sleep(20000);
        } catch (InterruptedException e) {System.out.println(e);}
    }

    @Override
    public void serialEvent(SerialPortEvent serialPortEvent) {
        switch (serialPortEvent.getEventType()) {
            case SerialPortEvent.BI:
                System.out.println("Serial Port Event: BI.");
            case SerialPortEvent.OE:
                System.out.println("Serial Port Event: OE.");
            case SerialPortEvent.FE:
                System.out.println("Serial Port Event: FE.");
            case SerialPortEvent.PE:
                System.out.println("Serial Port Event: PE.");
            case SerialPortEvent.CD:
                System.out.println("Serial Port Event: CD.");
            case SerialPortEvent.CTS:
                System.out.println("Serial Port Event: CTS.");
            case SerialPortEvent.DSR:
                System.out.println("Serial Port Event: DSR.");
            case SerialPortEvent.RI:
                System.out.println("Serial Port Event: RI.");
            case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
                System.out.println("Serial Port Event: OUTPUT_BUFFER_EMPTY.");
                break;
            case SerialPortEvent.DATA_AVAILABLE:
                System.out.println("Serial Port Event: DATA_AVAILABLE.");
                byte [] readBuffer = new byte [20];

                try {
                    while (inputStream.available() > 0) {
                        System.out.println("Number of bytes in inputstream = " + inputStream.available() + ".");
                        int numBytes = inputStream.read(readBuffer);
                    }
                    System.out.println(new String(readBuffer));
                } catch (IOException e) {System.out.println(e);}
                break;
        }
    }
}
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000180005b00, pid=15436, tid=4052
#
# JRE version: Java(TM) SE Runtime Environment (12.0.1+12) (build 12.0.1+12)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (12.0.1+12, mixed mode, sharing, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# C  [rxtxSerial.dll+0x5b00]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  S U M M A R Y ------------

Command Line: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Educational Edition 2019.3.3\lib\idea_rt.jar=15663:C:\Program Files\JetBrains\IntelliJ IDEA Educational Edition 2019.3.3\bin -Dfile.encoding=UTF-8 SerialPortDataRead

Host: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz, 8 cores, 15G,  Windows 10 , 64 bit Build 18362 (10.0.18362.329)
Time: Sat Apr 11 17:39:16 2020 Romance (zomertijd) elapsed time: 70 seconds (0d 0h 1m 10s)

---------------  T H R E A D  ---------------

Current thread (0x00000224ab664800):  JavaThread "Thread-0" [_thread_in_native, id=4052, stack(0x000000b2b0d00000,0x000000b2b0e00000)]

Stack: [0x000000b2b0d00000,0x000000b2b0e00000],  sp=0x000000b2b0dfdf00,  free space=1015k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [rxtxSerial.dll+0x5b00]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  gnu.io.RXTXPort.readArray([BII)I+0
j  gnu.io.RXTXPort$SerialInputStream.read([BII)I+212
j  gnu.io.RXTXPort$SerialInputStream.read([B)I+60
j  SerialPortDataRead.serialEvent(Lgnu/io/SerialPortEvent;)V+83
j  gnu.io.RXTXPort.sendEvent(IZ)Z+382
v  ~StubRoutines::call_stub
j  gnu.io.RXTXPort.eventLoop()V+0
j  gnu.io.RXTXPort$MonitorThread.run()V+12
v  ~StubRoutines::call_stub

siginfo: EXCEPTION_ACCESS_VIOLATION (0xc0000005), reading address 0xffffffffb0dfe9f8


Register to memory mapping:

RIP=0x0000000180005b00 rxtxSerial.dll
RAX=0x0000000000000001 is an unknown value
RBX=0x0 is NULL
RCX=0x000000018001d4d5 rxtxSerial.dll
RDX=0xfffffffffffff665 is an unknown value
RSP=0x000000b2b0dfdf00 is pointing into the stack for thread: 0x00000224ab664800
RBP=0x00000000ffffffff is an unknown value
RSI=0x0 is NULL
RDI=0x00000224ab664b30 points into unknown readable memory: e0 1d d7 a8 fe 7f 00 00
R8 =0x0000000000000002 is an unknown value
R9 =0xfffffffffffff63c is an unknown value
R10=0x00007ffea874b800 jvm.dll
R11=0x8101010101010100 is an unknown value
R12=0xffffffffb0dfe9f0 is an unknown value
R13=0x0000000000000001 is an unknown value
R14=0x000000b2b0dfe0f0 is pointing into the stack for thread: 0x00000224ab664800
R15=0x0 is NULL


Registers:
RAX=0x0000000000000001, RBX=0x0000000000000000, RCX=0x000000018001d4d5, RDX=0xfffffffffffff665
RSP=0x000000b2b0dfdf00, RBP=0x00000000ffffffff, RSI=0x0000000000000000, RDI=0x00000224ab664b30
R8 =0x0000000000000002, R9 =0xfffffffffffff63c, R10=0x00007ffea874b800, R11=0x8101010101010100
R12=0xffffffffb0dfe9f0, R13=0x0000000000000001, R14=0x000000b2b0dfe0f0, R15=0x0000000000000000
RIP=0x0000000180005b00, EFLAGS=0x0000000000010202

Top of Stack: (sp=0x000000b2b0dfdf00)
0x000000b2b0dfdf00:   0000000000000000 0000000000000000
0x000000b2b0dfdf10:   0000000000000000 00000224ab664b30
0x000000b2b0dfdf20:   0000000000000000 000000b2b0dfe0f0
0x000000b2b0dfdf30:   00000224aaf1a658 0000000000000001
0x000000b2b0dfdf40:   00000224ab664b30 0000000000000001
0x000000b2b0dfdf50:   ffffffffffffffff 0000000180006211
0x000000b2b0dfdf60:   00000224ab6668a0 ffffffffffffffff
0x000000b2b0dfdf70:   0000000000000001 00000224ab6668a0
0x000000b2b0dfdf80:   0000022400000001 00007ffeffffffff
0x000000b2b0dfdf90:   000000b2b0dfe0f8 000000b2b0dfe0f8
0x000000b2b0dfdfa0:   00000224aaf1a658 00000224ab664800
0x000000b2b0dfdfb0:   00000224ab4e5f90 00007ffea86f68c3
0x000000b2b0dfdfc0:   000000b2b0dfe650 0000000000000140
0x000000b2b0dfdfd0:   0000000000000140 0000109e0097b979
0x000000b2b0dfdfe0:   00000224aaf1a660 00000224aaf1a658
0x000000b2b0dfdff0:   00000224ab664800 000000b2b0dfe0f8 

Instructions: (pc=0x0000000180005b00)
0x0000000180005ae0:   15 23 7a 01 00 48 8d 48 60 e8 3a 5d 00 00 4c 8b
0x0000000180005af0:   e5 8b ac 24 88 00 00 00 44 8b ac 24 80 00 00 00
0x0000000180005b00:   45 8b 74 24 08 41 89 5c 24 08 41 8b fd 85 ed 78
0x0000000180005b10:   09 ff 15 e9 14 01 00 44 8b f8 45 85 ed 7e 4a 90 


Stack slot to memory mapping:
stack at sp + 0 slots: 0x0 is NULL
stack at sp + 1 slots: 0x0 is NULL
stack at sp + 2 slots: 0x0 is NULL
stack at sp + 3 slots: 0x00000224ab664b30 points into unknown readable memory: e0 1d d7 a8 fe 7f 00 00
stack at sp + 4 slots: 0x0 is NULL
stack at sp + 5 slots: 0x000000b2b0dfe0f0 is pointing into the stack for thread: 0x00000224ab664800
stack at sp + 6 slots: 0x00000224aaf1a658 is pointing into metadata
stack at sp + 7 slots: 0x0000000000000001 is an unknown value


---------------  P R O C E S S  ---------------

Threads class SMR info:
_java_thread_list=0x00000224ab56df70, length=12, elements={
0x00000224aaad8000, 0x00000224aaadb000, 0x00000224aaafa800, 0x00000224aaafb800,
0x00000224aaafe000, 0x00000224ab38a000, 0x00000224ab398000, 0x00000224ab381000,
0x00000224ab553000, 0x00000224ab553800, 0x00000224ab664800, 0x000002248714a000
}

Java Threads: ( => current thread )
  0x00000224aaad8000 JavaThread "Reference Handler" daemon [_thread_blocked, id=4676, stack(0x000000b2b0500000,0x000000b2b0600000)]
  0x00000224aaadb000 JavaThread "Finalizer" daemon [_thread_blocked, id=15876, stack(0x000000b2b0600000,0x000000b2b0700000)]
  0x00000224aaafa800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=10680, stack(0x000000b2b0700000,0x000000b2b0800000)]
  0x00000224aaafb800 JavaThread "Attach Listener" daemon [_thread_blocked, id=1472, stack(0x000000b2b0800000,0x000000b2b0900000)]
  0x00000224aaafe000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=2956, stack(0x000000b2b0900000,0x000000b2b0a00000)]
  0x00000224ab38a000 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=4168, stack(0x000000b2b0a00000,0x000000b2b0b00000)]
  0x00000224ab398000 JavaThread "Sweeper thread" daemon [_thread_blocked, id=712, stack(0x000000b2b0b00000,0x000000b2b0c00000)]
  0x00000224ab381000 JavaThread "Common-Cleaner" daemon [_thread_blocked, id=19676, stack(0x000000b2b0c00000,0x000000b2b0d00000)]
  0x00000224ab553000 JavaThread "Monitor Ctrl-Break" daemon [_thread_in_native, id=2040, stack(0x000000b2b0e00000,0x000000b2b0f00000)]
  0x00000224ab553800 JavaThread "Service Thread" daemon [_thread_blocked, id=9476, stack(0x000000b2b0f00000,0x000000b2b1000000)]
=>0x00000224ab664800 JavaThread "Thread-0" [_thread_in_native, id=4052, stack(0x000000b2b0d00000,0x000000b2b0e00000)]
  0x000002248714a000 JavaThread "DestroyJavaVM" [_thread_blocked, id=18784, stack(0x000000b2afe00000,0x000000b2aff00000)]

Other Threads:
  0x00000224aaad6800 VMThread "VM Thread" [stack: 0x000000b2b0400000,0x000000b2b0500000] [id=2128]
  0x00000224ab559800 WatcherThread [stack: 0x000000b2b1000000,0x000000b2b1100000] [id=3848]
  0x00000224871b1000 GCTaskThread "GC Thread#0" [stack: 0x000000b2aff00000,0x000000b2b0000000] [id=2932]
  0x00000224871cb800 ConcurrentGCThread "G1 Main Marker" [stack: 0x000000b2b0000000,0x000000b2b0100000] [id=12048]
  0x00000224871cd000 ConcurrentGCThread "G1 Conc#0" [stack: 0x000000b2b0100000,0x000000b2b0200000] [id=10912]
  0x00000224aa9ca800 ConcurrentGCThread "G1 Refine#0" [stack: 0x000000b2b0200000,0x000000b2b0300000] [id=716]
  0x00000224aa9cb800 ConcurrentGCThread "G1 Young RemSet Sampling" [stack: 0x000000b2b0300000,0x000000b2b0400000] [id=20468]

Threads with active compile tasks:

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Compilation events (10 events):
Event: 1.025 Thread 0x00000224ab38a000 nmethod 295 0x000002248fb59a90 code [0x000002248fb59c60, 0x000002248fb59e10]
Event: 1.025 Thread 0x00000224ab38a000  296       3       java.util.Properties::saveConvert (434 bytes)
Event: 1.027 Thread 0x00000224ab38a000 nmethod 296 0x000002248fb59e90 code [0x000002248fb5a380, 0x000002248fb5c5d0]
Event: 1.072 Thread 0x00000224aaafe000 nmethod 286 0x0000022497033f90 code [0x00000224970341a0, 0x00000224970355f8]
Event: 1.072 Thread 0x00000224aaafe000  293       4       java.lang.AbstractStringBuilder::ensureCapacityInternal (39 bytes)
Event: 1.081 Thread 0x00000224aaafe000 nmethod 293 0x0000022497035c10 code [0x0000022497035dc0, 0x00000224970361a8]
Event: 1.081 Thread 0x00000224aaafe000  297       4       java.lang.StringBuilder::append (8 bytes)
Event: 1.088 Thread 0x00000224aaafe000 nmethod 297 0x0000022497036310 code [0x00000224970364c0, 0x0000022497036988]
Event: 1.088 Thread 0x00000224aaafe000  298       4       java.lang.AbstractStringBuilder::append (77 bytes)
Event: 1.093 Thread 0x00000224aaafe000 nmethod 298 0x0000022497036c10 code [0x0000022497036dc0, 0x0000022497037268]

GC Heap History (0 events):
No events

Deoptimization events (5 events):
Event: 0.134 Thread 0x000002248714a000 Uncommon trap: reason=class_check action=maybe_recompile pc=0x000002249702d86c method=java.util.HashMap.putVal(ILjava/lang/Object;Ljava/lang/Object;ZZ)Ljava/lang/Object; @ 152 c2
Event: 0.142 Thread 0x000002248714a000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x000002249702e4a4 method=java.lang.String.isLatin1()Z @ 10 c2
Event: 1.022 Thread 0x00000224aaafb800 Uncommon trap: reason=class_check action=maybe_recompile pc=0x000002249702d86c method=java.util.HashMap.putVal(ILjava/lang/Object;Ljava/lang/Object;ZZ)Ljava/lang/Object; @ 152 c2
Event: 1.022 Thread 0x00000224aaafb800 Uncommon trap: reason=class_check action=maybe_recompile pc=0x000002249702d86c method=java.util.HashMap.putVal(ILjava/lang/Object;Ljava/lang/Object;ZZ)Ljava/lang/Object; @ 152 c2
Event: 1.022 Thread 0x00000224aaafb800 Uncommon trap: reason=class_check action=maybe_recompile pc=0x000002249702d86c method=java.util.HashMap.putVal(ILjava/lang/Object;Ljava/lang/Object;ZZ)Ljava/lang/Object; @ 152 c2

Classes redefined (0 events):
No events

Internal exceptions (4 events):
Event: 0.155 Thread 0x000002248714a000 Exception <a 'java/io/FileNotFoundException'{0x0000000711b28b98}> (0x0000000711b28b98) thrown at [t:/workspace/open/src/hotspot/share/prims/jni.cpp, line 615]
Event: 0.292 Thread 0x000002248714a000 Exception <a 'java/io/FileNotFoundException'{0x0000000711b3a860}> (0x0000000711b3a860) thrown at [t:/workspace/open/src/hotspot/share/prims/jni.cpp, line 615]
Event: 0.294 Thread 0x000002248714a000 Exception <a 'java/io/FileNotFoundException'{0x0000000711b48cc8}> (0x0000000711b48cc8) thrown at [t:/workspace/open/src/hotspot/share/prims/jni.cpp, line 615]
Event: 0.509 Thread 0x000002248714a000 Exception <a 'java/io/FileNotFoundException'{0x0000000711b5a3b0}> (0x0000000711b5a3b0) thrown at [t:/workspace/open/src/hotspot/share/prims/jni.cpp, line 615]

Events (10 events):
Event: 1.022 Thread 0x00000224aaafb800 DEOPT PACKING pc=0x000002249702d86c sp=0x000000b2b08fe780
Event: 1.022 Thread 0x00000224aaafb800 DEOPT UNPACKING pc=0x000002248f579c2f sp=0x000000b2b08fe700 mode 2
Event: 1.022 Thread 0x00000224aaafb800 Uncommon trap: trap_request=0xffffffde fr.pc=0x000002249702d86c relative=0x00000000000007ec
Event: 1.022 Thread 0x00000224aaafb800 DEOPT PACKING pc=0x000002249702d86c sp=0x000000b2b08fe780
Event: 1.022 Thread 0x00000224aaafb800 DEOPT UNPACKING pc=0x000002248f579c2f sp=0x000000b2b08fe700 mode 2
Event: 1.022 loading class java/util/LinkedHashMap$LinkedKeySet
Event: 1.023 loading class java/util/LinkedHashMap$LinkedKeySet done
Event: 20.556 Executing VM operation: RevokeBias
Event: 20.556 Executing VM operation: RevokeBias done
Event: 20.556 Thread 0x00000224ab665000 Thread exited: 0x00000224ab665000


Dynamic libraries:
0x00007ff658e60000 - 0x00007ff658e6f000     C:\Program Files\Java\jdk-12.0.1\bin\java.exe
0x00007ffec3640000 - 0x00007ffec3830000     C:\WINDOWS\SYSTEM32\ntdll.dll
0x00007ffec28d0000 - 0x00007ffec2982000     C:\WINDOWS\System32\KERNEL32.DLL
0x00007ffec05d0000 - 0x00007ffec0873000     C:\WINDOWS\System32\KERNELBASE.dll
0x00007ffec0a80000 - 0x00007ffec0b7a000     C:\WINDOWS\System32\ucrtbase.dll
0x00007ffeba0f0000 - 0x00007ffeba106000     C:\Program Files\Java\jdk-12.0.1\bin\VCRUNTIME140.dll
0x00007ffeba110000 - 0x00007ffeba128000     C:\Program Files\Java\jdk-12.0.1\bin\jli.dll
0x00007ffec3340000 - 0x00007ffec33e3000     C:\WINDOWS\System32\ADVAPI32.dll
0x00007ffec16f0000 - 0x00007ffec178e000     C:\WINDOWS\System32\msvcrt.dll
0x00007ffec3560000 - 0x00007ffec35f7000     C:\WINDOWS\System32\sechost.dll
0x00007ffec25e0000 - 0x00007ffec2700000     C:\WINDOWS\System32\RPCRT4.dll
0x00007ffec2c00000 - 0x00007ffec2d94000     C:\WINDOWS\System32\USER32.dll
0x00007ffec0880000 - 0x00007ffec08a1000     C:\WINDOWS\System32\win32u.dll
0x00007ffec2480000 - 0x00007ffec24a6000     C:\WINDOWS\System32\GDI32.dll
0x00007ffec1520000 - 0x00007ffec16b4000     C:\WINDOWS\System32\gdi32full.dll
0x00007ffeaf310000 - 0x00007ffeaf595000     C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.18362.720_none_e6beb5c51314836b\COMCTL32.dll
0x00007ffec09e0000 - 0x00007ffec0a7e000     C:\WINDOWS\System32\msvcp_win.dll
0x00007ffec3000000 - 0x00007ffec3336000     C:\WINDOWS\System32\combase.dll
0x00007ffec0960000 - 0x00007ffec09e0000     C:\WINDOWS\System32\bcryptPrimitives.dll
0x00007ffeba440000 - 0x00007ffeba44a000     C:\WINDOWS\SYSTEM32\VERSION.dll
0x00007ffec1790000 - 0x00007ffec17be000     C:\WINDOWS\System32\IMM32.DLL
0x00007ffeb9790000 - 0x00007ffeb983a000     C:\Program Files\Java\jdk-12.0.1\bin\msvcp140.dll
0x00007ffea8360000 - 0x00007ffea8ed4000     C:\Program Files\Java\jdk-12.0.1\bin\server\jvm.dll
0x00007ffec1910000 - 0x00007ffec1918000     C:\WINDOWS\System32\PSAPI.DLL
0x00007ffea5270000 - 0x00007ffea5279000     C:\WINDOWS\SYSTEM32\WSOCK32.dll
0x00007ffec33f0000 - 0x00007ffec345f000     C:\WINDOWS\System32\WS2_32.dll
0x00007ffeba9b0000 - 0x00007ffeba9d4000     C:\WINDOWS\SYSTEM32\WINMM.dll
0x00007ffeba980000 - 0x00007ffeba9ad000     C:\WINDOWS\SYSTEM32\winmmbase.dll
0x00007ffec0ba0000 - 0x00007ffec0bea000     C:\WINDOWS\System32\cfgmgr32.dll
0x00007ffec0530000 - 0x00007ffec0541000     C:\WINDOWS\System32\kernel.appcore.dll
0x00007ffeb9c60000 - 0x00007ffeb9c71000     C:\Program Files\Java\jdk-12.0.1\bin\verify.dll
0x00007ffebede0000 - 0x00007ffebefd4000     C:\WINDOWS\SYSTEM32\DBGHELP.DLL
0x00007ffe9d6a0000 - 0x00007ffe9d6ca000     C:\WINDOWS\SYSTEM32\dbgcore.DLL
0x00007ffeb9c30000 - 0x00007ffeb9c56000     C:\Program Files\Java\jdk-12.0.1\bin\java.dll
0x00007ffebb560000 - 0x00007ffebb56e000     C:\Program Files\Java\jdk-12.0.1\bin\instrument.dll
0x00007ffeb9c10000 - 0x00007ffeb9c27000     C:\Program Files\Java\jdk-12.0.1\bin\zip.dll
0x00007ffebb520000 - 0x00007ffebb52a000     C:\Program Files\Java\jdk-12.0.1\bin\jimage.dll
0x00007ffec1920000 - 0x00007ffec2005000     C:\WINDOWS\System32\SHELL32.dll
0x00007ffec2da0000 - 0x00007ffec2e49000     C:\WINDOWS\System32\shcore.dll
0x00007ffec0da0000 - 0x00007ffec1520000     C:\WINDOWS\System32\windows.storage.dll
0x00007ffec05a0000 - 0x00007ffec05c3000     C:\WINDOWS\System32\profapi.dll
0x00007ffec0550000 - 0x00007ffec059a000     C:\WINDOWS\System32\powrprof.dll
0x00007ffec0500000 - 0x00007ffec0510000     C:\WINDOWS\System32\UMPDC.dll
0x00007ffec2a40000 - 0x00007ffec2a92000     C:\WINDOWS\System32\shlwapi.dll
0x00007ffec0b80000 - 0x00007ffec0b97000     C:\WINDOWS\System32\cryptsp.dll
0x00007ffeb9ac0000 - 0x00007ffeb9ad9000     C:\Program Files\Java\jdk-12.0.1\bin\net.dll
0x00007ffeb4000000 - 0x00007ffeb40f1000     C:\WINDOWS\SYSTEM32\WINHTTP.dll
0x00007ffeaefc0000 - 0x00007ffeaf195000     C:\WINDOWS\SYSTEM32\urlmon.dll
0x00007ffeb17d0000 - 0x00007ffeb1a76000     C:\WINDOWS\SYSTEM32\iertutil.dll
0x00007ffebff40000 - 0x00007ffebff4c000     C:\WINDOWS\SYSTEM32\CRYPTBASE.DLL
0x00007ffebfd70000 - 0x00007ffebfdd7000     C:\WINDOWS\system32\mswsock.dll
0x00007ffeb9a90000 - 0x00007ffeb9aa3000     C:\Program Files\Java\jdk-12.0.1\bin\nio.dll
0x00007ffeb9a70000 - 0x00007ffeb9a8a000     C:\Program Files\JetBrains\IntelliJ IDEA Educational Edition 2019.3.3\bin\breakgen64.dll
0x0000000180000000 - 0x0000000180025000     C:\Program Files\Java\jdk-12.0.1\bin\rxtxSerial.dll

dbghelp: loaded successfully - version: 4.0.5 - missing functions: none
symbol engine: initialized successfully - sym options: 0x614 - pdb path: .;C:\Program Files\Java\jdk-12.0.1\bin;C:\WINDOWS\SYSTEM32;C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.18362.720_none_e6beb5c51314836b;C:\Program Files\Java\jdk-12.0.1\bin\server;C:\Program Files\JetBrains\IntelliJ IDEA Educational Edition 2019.3.3\bin

VM Arguments:
jvm_args: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Educational Edition 2019.3.3\lib\idea_rt.jar=15663:C:\Program Files\JetBrains\IntelliJ IDEA Educational Edition 2019.3.3\bin -Dfile.encoding=UTF-8 
java_command: SerialPortDataRead
java_class_path (initial): D:\MICHIEL\KULeuven\Industrieel Ingenieur Semester_6\EE5\SerialPortDataRead\out\production\SerialPortDataRead;D:\MICHIEL\KULeuven\Industrieel Ingenieur Semester_6\EE5\SerialPortDataRead\libs\RXTXcomm.jar
Launcher Type: SUN_STANDARD

[Global flags]
     intx CICompilerCount                          = 4                                         {product} {ergonomic}
     uint ConcGCThreads                            = 2                                         {product} {ergonomic}
     uint G1ConcRefinementThreads                  = 8                                         {product} {ergonomic}
   size_t G1HeapRegionSize                         = 1048576                                   {product} {ergonomic}
    uintx GCDrainStackTargetSize                   = 64                                        {product} {ergonomic}
   size_t InitialHeapSize                          = 266338304                                 {product} {ergonomic}
   size_t MarkStackSize                            = 4194304                                   {product} {ergonomic}
   size_t MaxHeapSize                              = 4261412864                                {product} {ergonomic}
   size_t MaxNewSize                               = 2556428288                                {product} {ergonomic}
   size_t MinHeapDeltaBytes                        = 1048576                                   {product} {ergonomic}
    uintx NonNMethodCodeHeapSize                   = 5836300                                {pd product} {ergonomic}
    uintx NonProfiledCodeHeapSize                  = 122910970                              {pd product} {ergonomic}
    uintx ProfiledCodeHeapSize                     = 122910970                              {pd product} {ergonomic}
    uintx ReservedCodeCacheSize                    = 251658240                              {pd product} {ergonomic}
     bool SegmentedCodeCache                       = true                                      {product} {ergonomic}
     bool UseCompressedClassPointers               = true                                 {lp64_product} {ergonomic}
     bool UseCompressedOops                        = true                                 {lp64_product} {ergonomic}
     bool UseG1GC                                  = true                                      {product} {ergonomic}
     bool UseLargePagesIndividualAllocation        = false                                  {pd product} {ergonomic}

Logging:
Log output configuration:
 #0: stdout all=warning uptime,level,tags
 #1: stderr all=off uptime,level,tags

Environment Variables:
PATH=C:\Program Files (x86)\Microchip\mplabc18\v3.47\mpasm;C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files (x86)\Acronis\CommandLineTool\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\National Instruments\Shared\LabVIEW CLI;C:\Program Files (x86)\IVI Foundation\IVI\bin;C:\Program Files\IVI Foundation\IVI\bin;C:\Program Files\IVI Foundation\VISA\Win64\Bin\;C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin\;C:\PROGRA~2\IVIFOU~1\VISA\WinNT\Bin;C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Git\cmd;C:\Program Files (x86)\Microchip\xc8\v2.05\bin;C:\Program Files\Common Files\Autodesk Shared\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\PuTTY\;C:\Program Files (x86)\Microchip\mplabc18\v3.47\mpasm;C:\Program F
USERNAME=Michiel
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 158 Stepping 9, GenuineIntel



---------------  S Y S T E M  ---------------

OS: Windows 10 , 64 bit Build 18362 (10.0.18362.329)

CPU:total 8 (initial active 8) (4 cores per cpu, 2 threads per core) family 6 model 158 stepping 9, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, 3dnowpref, lzcnt, ht, tsc, tscinvbit, bmi1, bmi2, adx, fma

Memory: 4k page, system-wide physical 16250M (7829M free)
TotalPageFile size 18682M (AvailPageFile size 5179M)
current process WorkingSet (physical memory assigned to process): 37M, peak: 39M
current process commit charge ("private bytes"): 339M, peak: 343M

vm_info: Java HotSpot(TM) 64-Bit Server VM (12.0.1+12) for windows-amd64 JRE (12.0.1+12), built on Apr  2 2019 14:02:19 by "mach5one" with MS VC++ 15.5 (VS2017)

END.

I'm using Java 12.0.1. When searching around for this problem I encountered a few other people with kinda the same problem, but found no solution. Has anyone experienced this problem before or could anyone point me in the right direction? I'm pretty new to the whole COM port serial thing.

Thanks in advance!


Solution

  • So I found a solution. I used the jSerialComm library from fazecast with almost the same code and it worked.