---
title: "【转】关于“The type **** is not accessible due to restriction on required library”问题的"
author: "wangyanlong0107"
date: "2012-05-09T11:10:44Z"
tags: []
categories: ["编程语言"]
slug: "the-type-is-not-accessible-due-to-restriction-on-required-library"
draft: false
lastmod: "2012-05-09T11:10:44Z"
id: 1518571
url: "https://bigdragon.iteye.com/blog/1518571"
---

在eclipse里出现“The type \*\*\** is not accessible due to restriction on required library”的错误，大概的意思就是要导入的包被限制了。

 

解决方法：

  选中项目--右键--进入Properties(属性)视图

  选中Java Build Path--点击Libraries--展开JRE System Library\[JavaSE-1.6],选中Access rules这一项（如果没有，那就是JDK安装和配置的问题）。

   Edit--点击Add--在Rule Pattern（规则式样）编辑你允许导入的类库，如本例中输入(javax/servlet/\*\*)，允许就是在Resolution选项中选中Accessible（当然，有些项目需要可以选择Forbidden、Discourage某些类库）。

   然后重启就可以了。