0

Am using eclipse and whenever I try importing the following:

import com.sun.org.apache.xml.internal.serialize.OutputFormat;
import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
import com.sun.xml.internal.bind.util.AttributesImpl;

I always get an error message:

Access restriction: The type OutputFormat is not accessible due to restriction on required library C:\Program Files\Java\jre7\lib\rt.jar

How can I fix it?

John Kugelman
  • 349,597
  • 67
  • 533
  • 578

1 Answers1

1
  1. Go to the Build Path settings in the project properties.
  2. Remove the JRE System Library
  3. Add it back; Select "Add Library" and select the JRE System Library. The default worked for me.

This works because you have multiple classes in different jar files. Removing and re-adding the jre lib will make the right classes be first. If you want a fundamental solution make sure you exclude the jar files with the same classes.

OR ...

Windows -> Preferences -> Java -> Compiler -> Errors/Warnings -> Deprecated and trstricted API -> Forbidden reference (access rules): -> change to warning

http://www.digizol.com/2008/09/eclipse-access-restriction-on-library.html

MGot90
  • 2,422
  • 4
  • 15
  • 31