国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

實例:創建SWT項目的原生庫導入問題

2024-07-21 02:14:31
字體:
來源:轉載
供稿:網友

  對于 eclipse 3.1.x 而言,并沒有書中提到的那個“org.eclipse.swt.win32_3.0.1”目錄,自然也不會有目錄下的 swt.jar 和 swt-win32-3063.dll,這個目錄在 eclipse 3.1.x 中被 org.eclipse.swt.win32.win32.x86_3.1.x.jar 文件替代,而原生庫文件也被壓縮到這個 jar 文件中,用 winrar 解壓即可得到。

  在安裝了 swt designer 后通過其建立項目時,會自動導入所有必須的 jar 文件到項目中,無需手動導入,但如果之前解壓了 org.eclipse.swt.win32.win32.x86_3.1.x.jar 文件,請將解壓目錄刪除之后再建立項目,否則會導入出錯。這個錯誤是因為導入了解壓得到的 “org.eclipse.swt.win32.win32.x86_3.1.x”目錄,可以手動修改為導入整個 jar 文件就 ok 了。

  接下來是原生庫的導入,我發現用書上的方法導入原生庫到項目中(實際就是將 swt-win32-xxxx.dll 文件復制到項目根目錄),會出現問題。后來翻查《swt/jface in action》得知,有多種方法導入原生庫,但作者發現最好的方法是將 swt-win32-xxxx.dll 文件直接復制到“$java/jre/bin”目錄下,這樣才不會引起諸多問題。

  總結解決步驟:

  ①安裝 eclipse 3.1.x 和 swt designer,解壓 org.eclipse.swt.win32.win32.x86_3.1.x.jar 文件。

  ②復制 swt-win32-xxxx.dll 到“$java/jre/bin”目錄下。

  ③刪除解壓 org.eclipse.swt.win32.win32.x86_3.1.x.jar 得到的文件夾。

  ④新建 swt/jface java project,然后就可以直接新建 swt 類文件了,無需再導入原生包。

  ps:推薦參考《swt/jface in action》配合《eclipse 入門和精通》進行學習。在《swt/jface in action》附錄“creating projects with swt/jface”中的 316 頁可以找到關于導入原生圖形庫的講述:

  once you’ve found the graphics library, you need to make sure the application launcher can use it. the documentation lists a number of ways to do this, but we’ve found that adding a copy to the $java/jre/bin directory works best.

  other methods, which can be less reliable, include the following:

  option 1: copy and paste these files directly in the widgetwindow project.

  option 2: include the native library in any directory pointed to by the java.library.path variable. this variable, among others, can be seen by clicking help->about eclipse platform->configuration details.

  option 3: go to control panel->system->advanced->environmental variables and update the path variable with the directory containing the library file.

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 庐江县| 泰兴市| 龙陵县| 阿荣旗| 依兰县| 出国| 无极县| 阳新县| 垫江县| 马尔康县| 潜山县| 武强县| 吐鲁番市| 五常市| 兴山县| 凉山| 陆丰市| 禹城市| 北川| 前郭尔| 洛宁县| 永春县| 泸州市| 项城市| 平果县| 湖北省| 四平市| 昌乐县| 阿拉善左旗| 盐边县| 汾阳市| 健康| 宾川县| 贵港市| 贵南县| 遂溪县| 临汾市| 临汾市| 洛扎县| 武宁县| 江都市|