Access restriction: The type XXX is not accessible due to restriction on required library XXX

- Access restriction: The type IInboundMessageNotification is not accessible due to restriction on required library C:\Program Files\Java\jdk\jre\lib\ext
  \jdsmsserver-3.4.jar

google了一下 下面是解決方法

Eclipse 默認把這些受訪問限制的API設成了ERROR。只要把Windows-Preferences-Java-Complicer- Errors/Warnings裏面的Deprecated and restricted API中的Forbidden references(access rules)選爲Warning就可以編譯通過。

不過這個不好

如果你的jre目錄裏面有你項目需要引用的jar包

而你又引用了外部jar包

也就是說引用了兩次

如果你想讓起作用的是手動引用的外部jar包 這個時候需要把 "Referenced Library" 調整到 "JRE System Library"上面

引用的順序是從上到下

改變順序前的效果:

build path

最後效果

OK 一切正常...

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章