CI test using libpcap

I would like to run test using network sniffing features (like wireshark).
First tentative, I ran error saying

org.pcap4j.core.PcapNativeException: lo: You don’t have permission to capture on that device (socket: Operation not permitted)

So, according to this post I set to java the capabilities to capture.
for this I added theses two lines on my .yml file

    - name: Set permission to capture network packets (pcap)
      run: sudo setcap cap_net_raw,cap_net_admin=eip $(readlink -f $(which java))

And now the job failed during the next step, a maven package operation, with this error:

Run mvn -B package --file pom.xml
  mvn -B package --file pom.xml
  shell: /usr/bin/bash -e {0}
    JAVA_HOME: /opt/hostedtoolcache/Java_Zulu_jdk/15.0.3-3/x64
/opt/hostedtoolcache/Java_Zulu_jdk/15.0.3-3/x64/bin/java: error while loading shared libraries: cannot open shared object file: No such file or directory
Error: Process completed with exit code 127.

I feel stuck, any help yould be appreciated.

The issue comes from the fact that actions/setup-java does not properly setup Java. In theory, it should also reference its lib directories so that the system knows where to look for them, and also ask the system to update its library cache. This is achieved through the 2 following actions:

    - name: Add this JDK's libs to the system's library paths
      run: echo "${JAVA_HOME}/lib" | sudo tee -a /etc/
    - name: Update system's library paths
      run: sudo ldconfig