This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Access Restriction error when try to use "sun.net.util.IPAddressUtil"
Abhra Kar
Ranch Hand
Joined: May 22, 2008
Posts: 112
posted
0
Hi,
I want to check a string suppose "101a:1450::" is Ipv6Address or not. To test that I used IPAddressUtil.isIPv6LiteralAddress("101a:1450::") , and to do this I had to import sun.net.util , but when i write the code in eclipse it shows an error like -------
Access restriction: The type IPAddressUtil is not accessible due to restriction on required library D:\Java\jdk1.5.0_05\jre\lib
\rt.jar
how to solve this error , do I have to add any permission somewhere? Please suggest.
My guess is that you have two different versions of the rt.jar file in your classpath. And whichever one you are trying to get IPAddressUtil out of is the second one being loaded. It is either that or another JAR has a sun.net.util.IPAddressUtil class defined in it and is causing the same conflict. Check your classpath, make sure you know exactly what jars and libraries are being loaded.
Thanks for the link ,I will try to avoid this package in future but to solve this problem for now I checked the classpath,
only one rt,jar is set, so there is no conflict .Do I have to add any permission for this in java.policy file under "\jdk1.6.0\jre\lib\security"
Abhra Kar wrote: but when i write the code in eclipse it shows an error like -------
Access restriction: The type IPAddressUtil is not accessible due to restriction on required library D:\Java\jdk1.5.0_05\jre\lib
\rt.jar
You see that error at runtime or do you see that as a red error mark that Eclipse shows up in the code? If it's an runtime error, can you post the entire exception stacktrace? By the way, what happens when you don't use an IDE to compile or run that code?
I see that as a red error mark that Eclipse shows up in the code, but when I run with out eclipse(simply write in a Test class in notepad) then it's compile and run properly, thanks for the suggestion, what can be the error in eclipse
Thanks
Abhra
Stuart A. Burkett
Ranch Hand
Joined: May 30, 2012
Posts: 321
posted
0
Try googling eclipse "is not accessible due to restriction on required library" and you'll get a number of hits giving reasons for the warning and how to get rid of it.