Friday, 11 September 2009

Eclipse Error : Access restriction:The method ..

Error message ..

Access restriction: The method createJPEGEncoder(OutputStream) from the type JPEGCodec is not accessible due to restriction on required library C:\Program Files\Java\jdk1.6.0_11\jre\lib\rt.jar   

Access restriction: The method getDefaultJPEGEncodeParam(BufferedImage) from the type JPEGImageEncoder is not accessible due to restriction on required library C:\Program Files\Java\jdk1.6.0_11\jre\lib\rt.jar   

Access restriction: The method setJPEGEncodeParam(JPEGEncodeParam) from the type JPEGImageEncoder is not accessible due to restriction on required library C:\Program Files\Java\jdk1.6.0_11\jre\lib\rt.jar    ImageUtil.java   

Solution

Go to Project properties -->Java Compiler --> Errors Warnings, Then enable project specific settings,
 Expand Deprecated and restrited APIs category
  -Forbidden reference (acess rule) , Change to warning or ignore.

17 comments:

Unknown said...

Hello, I'm a Japanese engineer.

I'm trying to create a programming. But I had the same problem as you. This blog was helpful for me.

Thank you so much!!

Thank again and Regards

Unknown said...

Hello!

Now I'm trying to create a programming. But I had the same problem as you. This blog helped me!

Thank you very much and Regards

Anonymous said...

you have a wonderful site!

Anonymous said...

This was really helpful. I am using MyEclipse 6.6.

To accomplish the same thing for all projects I discovered that you can do this:

1. Go to Window > Preferences > Java > Compiler > Errors/Warnings > Deprecated and restricted API
2. Change Forbidden reference (access rules) to “Warning” or “Ignore”.

kripa said...

Thanks for that

Srini.T said...

Thx dude .. The magic worked 4 me..

Anonymous said...

thanks... i solved my problem

Ying at NCCS

John said...

Thanks for your easy to understand solution. This saved me a lot of time! :)

Jeroen said...

thanks this was helpful on a java 3d tutorial!

Anonymous said...

Hey, I am checking this blog using the phone and this appears to be kind of odd. Thought you'd wish to know. This is a great write-up nevertheless, did not mess that up.

- David

Unknown said...

that was good! thanks !!!

Rekha said...

That was it! Thank you!

Unknown said...

Thanks !!

montu said...

tanx so much..:)

Anonymous said...

AWESOME...
HELPED A LOT
THANK YOU VERY MUCH

P.S. CAN YOU PROVIDE INFORMATION ABOUT WHY THESE ACCESS RESTRICTION
OCCURES.

Anonymous said...

Thank you from Russia!

Anonymous said...

Thank you from India.....