diff --git a/jdk7/src/main/java/pcap/jdk7/internal/NativeMappings.java b/jdk7/src/main/java/pcap/jdk7/internal/NativeMappings.java index f2332ffd..543b47fe 100644 --- a/jdk7/src/main/java/pcap/jdk7/internal/NativeMappings.java +++ b/jdk7/src/main/java/pcap/jdk7/internal/NativeMappings.java @@ -62,10 +62,12 @@ class NativeMappings { new HashMap(); static { - File NPCAP_DIR = Paths.get(System.getenv("SystemRoot"), "System32", "Npcap").toFile(); + if (Platform.isWindows() && System.getProperty("jna.library.path") == null) { + File NPCAP_DIR = Paths.get(System.getenv("SystemRoot"), "System32", "Npcap").toFile(); - if (Platform.isWindows() && System.getProperty("jna.library.path") == null && NPCAP_DIR.exists()) { - NativeLibrary.addSearchPath("wpcap", NPCAP_DIR.getAbsolutePath()); + if (NPCAP_DIR.exists()) { + NativeLibrary.addSearchPath("wpcap", NPCAP_DIR.getAbsolutePath()); + } } }