Access restriction on class due to restriction on required library

(0 votes, average 0 out of 5)

If you are using Eclipse or Rational Application Developer (RAD) and encounter the following error causing your build to break, here is a work around that will help you get past the problem:

Error: "Access Restriction: The type {class name} is not accessible due to restriction on required library: {library path}"

Work around: In Eclipse or RAD, go to Windows -> Preferences -> Java -> Compiler -> Errors/Warnings -> Deprecated and restricted API -> Forbidden reference (Access Rules) -> Change from "Error" to "Warning"

This will cause Eclipse/RAD to show a warning instead of an error, allowing you to build your project successfully. The reason that this error happens is likely due to a library class attempting to replace a standard class that comes with Java 5 or later. Due to licensing restrictions, replacing a standard class is not allowed but was not enforced until Java 5 or later.  Additionally, instead of changing the reference rules, the offending class can be removed from a jar file if needed.


Partner Links:
Last Updated on Friday, 17 September 2010 10:58  
Related Articles

» PHP Parse Error: Unexpected $

ErrorA PHP parse error returns, citing an "unexpected $".  Because this is a parse error, the PHP script does not run to any extent.SolutionThis error almost always results in a missing bracket somewhere.  Check your code carefully for missing brackets.  Using a PHP IDE can be useful for checking brackets that are not closed.  Brackets that span multiple PHP sections can be the trickiest to miss.  For instance:12345678910<?php$x = 3;if($x == 3){?> <a...

» Useful Opensource Java Libraries and Frameworks

Many open source libraries/frameworks exist for Java that can make coding certain tasks significantly easier, but finding these libraries/frameworks can be a different matter entirely! This article is devoted to compiling some of the more common useful Java libraries and some of the lesser known libraries.Apache Commons: ..................    Huge collection of useful components to help manage 'common' coding tasks. Commons.Lang and Commons.IO are extremely. Google...

» How to Exit in Python

Exiting in python is fairly straight-forward.  You need to import the "sys" library, and then call exit from it.123import sys sys.exit()Calling exit with no arguments is a clean exit -- no error code is returned.  If you'd like to exit with an error message, simply pass the message as a parameter and exit will automatically exit with an error and print your message.123import sys sys.exit("This is an example of an error message")