importing objects in Java (Eclipse)

This question already has an answer here:

  • Access restriction on class due to restriction on required library rt.jar? 15 answers
  • Import access restriction in java 2 answers

  • Go to the Build Path settings in the project properties.
  • Remove the JRE System Library
  • Add it back; Select "Add Library" and select the JRE System Library. The default worked for me.
  • This works because you have multiple classes in different jar files. Removing and re-adding the jre lib will make the right classes be first. If you want a fundamental solution make sure you exclude the jar files with the same classes.

    OR ...

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

    http://www.digizol.com/2008/09/eclipse-access-restriction-on-library.html

    链接地址: http://www.djcxy.com/p/73798.html

    上一篇: 为什么我得到这个错误:'Empty'类型不是API?

    下一篇: 在Java中导入对象(Eclipse)