2010年3月26日 星期五

Eclipse上的access restriction 錯誤訊息

Access restriction: The type SerialPortEventListener is not accessible due to restriction on required library C:\Program Files\Java\jre6\lib\ext\comm.jar

當要用外部的library時,告訴我不能用,之前一直以為是哪個環節出錯...

今天上了google查一下,原來只是eclipse的環境設定問題...

Windows -> Preferences -> Java -> Compiler -> Errors/Warnings -> Deprecated and trstricted API -> Forbidden reference (access rules): -> change to warning

參考這裡

2 則留言:

傑夫林的部落格 提到...

後來又找到另一篇
1. Open project properties.
2. Select Java Build Path node.
3. Select Libraries tab.
4. Remove JRE System Library.
5. Add Library JRE System Library.

這樣竟然也可以...

龍 提到...

感謝!!解決我的問題