簡體   English   中英

NetUtils Java庫-如何使其工作?

[英]NetUtils java library - how to make it work?

我試圖使用幾個月前在Java中找到的庫來編輯數據包。 該庫“類似於” jnetpcap,但功能更豐富,最重要的似乎是較新的並且沒有蟲子...這是該項目的開源主頁: https : //code.google.com/p/netutils/downloads/ detail?name = netutils_toturial.pdf&can = 2&q =在手冊中,編寫此庫的人員說,我們需要使用“ libnet.lib”和“ netutils.dll”文件。 我不太確定如何使它工作,在嘗試運行簡單代碼時似乎帶有“ netutils.dll”問題。 希望得到某人的答復。 非常感謝。

從pdf文檔中:

Java庫使用Java JNI(Java本機接口)調用C代碼。

C代碼被編譯成兩個共享庫(Linux)或dll(Windows)。 動態庫應放置在java java.library.path(JVM搜索動態庫的路徑)中。

 There are two options for placing the libraries: 1. Putting the libraries in one of the default path's. 2. Put the library anywhere and add the path to the java.library.path as shown: java -Djava.library.path=place..... 

您是否嘗試過這些選項中的任何一個?

對於第1點,您可以使用塢站中報告的以下代碼來檢測哪個是您的java.library.path:

public class ShowJavaLibraryPath {
    public static void main(String [] args) {
         System.out.println(System.getProperty(”java.library.path”));
    }
}

如果您喜歡第2點,只需將.dll添加到您喜歡的位置,然后將-Djava.library.path=folder_you_choose選項添加到“運行配置”參數中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM