I get this error message in Eclipse:
Access restriction: The type DirectoryWalker is not accessible
due to restriction on required library
/Library/Java/Extensions/commons-io-1.4.jar
what does this mean? There's this other SO question on the same topic but it doesn't seem to apply in this case. I'm not creating a new java class, I'm trying to use one.
Assuming you are using Eclipse + m2e maven plugin, if you get this access restriction error, right click on the project/module in which you have the error --> Properties --> Build Path --> Library --> Replace JDK/JRE to the one that is used in eclipse workspace. I followed the above steps and the issue is resolved.
rt. jar contains all of the compiled class files for the base Java Runtime environment, as well as the bootstrap classes, which are the run time classes that comprise the Java platform core API.
go to java build path and under Library tab, remove JRE System Library. Then again Add Library --> JRE System Library
Worked for me
This is my least-favorite error, I've run into it a few times, and the "restriction on required library" is just dull enough to leave you scratching your head. However, it's easy to fix.
The quickest way (I'm using Helios) is to go to Window->Preferences->Java->Compiler->Errors/Warnings, find and open the "Deprecated and Restricted API" bullet, and set Forbidden and Discouraged Reference to something other than Error.
"Warning" is usually best, as something out there in Java land is triggering this and you probably want a footnote on it. @SuppressWarnings and its cousins, 98% of the time, have the same effect on a programmer's personal and social logic as, say, an ether binge might. But that's just my humble analysis.
Best of luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With