獲得OSGi Bundle相關的路徑信息

(1)  獲得OSGi Bundle安裝的根路徑:
FileLocator.getBundleFile(Platform.getBundle(“bundle_id”)).getAbsolutePath();
Platform.getBundle方法調用並不會Activate當前Bundle, 其只是獲得當前系統內相應的被解析(Resolved)的Bundle
(2) 獲得OSGi Bundle的 State Location.
Activator.getDefault().getStateLocation()
需要注意的是,該方法調用要求當前的Bundle必須是Active狀態。
發佈了59 篇原創文章 · 獲贊 18 · 訪問量 15萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章