java – Eclipse 3.5. 1 compiler error: due to error on required Library/ The outputformat type cannot be accessed due to the restriction of rt.jar

The mistake is so strange that I can't understand it I have installed eclipse RCP 3.5 1,

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

I received an error:

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

I have googled and read some replies here... The problem still exists Interestingly, if I used the previous eclipse RCP (version: 3.4.2), this problem would never happen 3.4. Version 2 uses the same JRE version. I just tested the SWT version Work well I think this problem depends on some plug-ins of the new ide Any ideas?

PS: I found this article But I don't like or want to change the code if I don't need it The first is what is the root of the problem, and the solution will follow

Solution

The default configuration of the eclipse compiler is too strict You can relax Java by opening its preferences – > compiler – > errors / warnings and the "prohibit references (access rules)" setting under "deprecated and restricted APIs" can be changed from errors to warnings or ignored

But the question is, do you really want to use COM sun.- Classes in package because there is no guarantee that these classes will be available in VMS from different vendors or newer VMS in sun

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>