This is a common error occurs when you use any deprecated library in Eclipse IDE project settings.The reason behind this error can be,
- Classpath conflict.
- Using old versions of jre/libs
- Forbidden reference – Deprecated and restricted API
Try to configure the latest jars possible to avoid deprecated libs. Resolve the classpath conflict by checking duplicate library entries in the classpath.
If the above steps are not working, you can configure the IDE to resolve this error as follows.
OpenĀ Windows -> Preferences -> Java -> Compiler -> Errors/Warnings
Go to (Project) Properties -> Java Compiler -> Errors/Warnings
Locate the “Forbidden reference (access rules)” option under “Deprecated and restricted API” section in the dialog box. This option decides how to handle access rules defined inside Eclipse. By default it is set to “Error” which causes Eclipse to complain about references to any restricted classes. Choosing option Warning or Ignore will remove these error messages.
But be careful when you change this settings. It is better not to set the value to ‘Ignore’. If you keep the value as ‘Ignore’ will hide any potential issue in the project and you will not be aware of that. The safest way to handle is to set the value as ‘Warning’.