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

» Resolve Input/Output error when trying to write to WebDAV (davfs2) mount like box.net on Linux

These instructions assume that you already configured the WebDAV filesystem by following .If you are mounting a WebDAV folder on Linux using the davfs2 FUSE filesystem, you may encounter the following error when trying to write a file to the WebDAV filesystem:cp: cannot create regular file `test.txt': Input/output errorThis is caused by the WebDAV filesystem not supporting file locks. The solution is to disable file locks in the davfs2 configuration file, located...

» 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...

» ASP.NET Error: Cannot create/shadow copy when that file already exists.

 Occasionally when using a debugger in ASP.NET (or shortly after using the debugger), your solution may return the following error when viewing in a browser:Cannot create/shadow copy when that file already exists.This is a problem rooted in how solutions build for ASP.NET - they are often built into binaries that are placed in a "shadow" location so that the user may continue editing and saving the code without any consequence to the current built solution.  Sometimes this process will...