You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the library on Linux it fails to start up with the following exception:
Caused by: java.lang.NullPointerException
at java.base/java.util.Objects.requireNonNull(Objects.java:209)
at java.base/sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:263)
at java.base/java.nio.file.Path.of(Path.java:147)
at java.base/java.nio.file.Paths.get(Paths.java:69)
at org.pcap4j.core.NativeMappings.(NativeMappings.java:46)
I was using the library via Maven dependency
org.pcap4j
pcap4j-core
2.0.0-alpha.6
Looking at the code we can see that it's trying to use an environment variable called "SystemRoot" which won't exist when running on Linux.
static final File NPCAP_DIR =
Paths.get(System.getenv("SystemRoot"), "System32", "Npcap").toFile();
To work around the problem all you need to do is to define the environment variable before starting the application using the library. So there is an easy work around.
export SystemRoot=""
However updating the code with a Platform.isWindows() check will avoid having to do this.
The text was updated successfully, but these errors were encountered:
When using the library on Linux it fails to start up with the following exception:
Caused by: java.lang.NullPointerException
at java.base/java.util.Objects.requireNonNull(Objects.java:209)
at java.base/sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:263)
at java.base/java.nio.file.Path.of(Path.java:147)
at java.base/java.nio.file.Paths.get(Paths.java:69)
at org.pcap4j.core.NativeMappings.(NativeMappings.java:46)
I was using the library via Maven dependency
org.pcap4j
pcap4j-core
2.0.0-alpha.6
Looking at the code we can see that it's trying to use an environment variable called "SystemRoot" which won't exist when running on Linux.
static final File NPCAP_DIR =
Paths.get(System.getenv("SystemRoot"), "System32", "Npcap").toFile();
To work around the problem all you need to do is to define the environment variable before starting the application using the library. So there is an easy work around.
export SystemRoot=""
However updating the code with a Platform.isWindows() check will avoid having to do this.
The text was updated successfully, but these errors were encountered: