在使用Jpcap 网络抓包时,前期使用一切正常。可是,今天调整了一下jre环境时,一直报错Access restriction: The type JpcapCaptor is not accessible due to restriction on required library C:\Windows\Sun\Java\lib\ext\jpcap.jar
查了会资料,找到此博客。感觉是写的最好的一个。也很详细,自己就转载过来了,不费时间写了。
http://hi.baidu.com/ccst2005/blog/item/c8f84a223172d0f4d6cae24b.html
主要问题应该是Access restrictions on Jars ,就是对一些jar包的访问受限,在一番搜索后发现,主要是过期的API不再被支持~看来过期的东西用时还是要小心~~顺便收集了一些资料,留着以后用吧。
http://www.eclipsezone.com/eclipse/forums/t97259.html
When developing plug-in projects, you may occasionally get a message saying "The type X is not accessible due to restriction on required project Y". The basic reason for this message is that the dependency of one project to another's exported packages doesn't match what you're expecting. If you depend on a bundle "Wall" that exports package "wall", and you import "wall.Brick" then that'll work fine. If, on the other hand, you import "wall.test.Brick" (and assume that the only mentioned export is Export-Package: wall) then you'll get this restriction error.
You may also get it when depending on a specific version of the JRE (or an OSGi execution environment). That's because whilst the standard class packages (e.g. java.util etc.) are exported, the extras that come with the JRE (e.g. sun.misc.Base64Encoder) aren't technically part of the Java core libraries, and thus shouldn't be assumed to exist (there is a Apache Commons Codec project that contains a Base64 if you need it).
You can view and edit the access rules for individual Jars or JREs; you can also specify them implicitly with the Manifest.MF's Import-Package or Require-Bundle rules (for consumers of APIs) or the Export-Package (for producers of APIs). If an OSGi manifest is provided, it will automatically set up access rules for all exported packages and hide all non-imported packages. (In addition, it's also possible to mark package references as 'internal' which is done by showing what down-stream plugins can consume particular APIs, although this should rarely be needed.)
One final point; if you're setting up multiple plug-ins, then use the OSGi manifest to express dependencies. Don't add Jars via the .classpath (or the GUI equivalent Java Build Path) -- and whatever you do, don't export the 'required plugin dependencies' container to downstream projects; in 3.2, this could result in an access rule visibility error even when the OSGi manifests were correct. (It's fixed in 3.3.)
For those of you not using Eclipse PDE, then the net effect is that you'll end up with bundles looking like this:
Manifest.MF
Bundle-SymbolicName: example
Export-Package:
com.example.public, // Anyone can access com.example.public if imported
com.example.test;x-internal:=true, // This is marked as internal, but can be used
com.example.impl;x-friends:=com.example.other, // Only com.example.other should access it
com.example.split;common="split";mandatory:="common" // Split is a split package
It's worth noting that the x-friends and x-internal are aspects unique to Equinox; they're not part of the standard OSGi specification. The 'common-split' is not part of the spec either, but the 'mandatory' lists attribute names (including 'common' in this case) which are needed for an importer to use those packages. Since the org.eclipse.core.runtime bundle explicitly requires the org.eclipse.equinox.common bundle, and then re-exports it, it presents a unified classpath for those wishing to use the org.eclipse.core.runtime package which acts in just this way.
(下面的这种方法指标不治本,属于鸵鸟算法~只是把error变成warning或者ignore了)
"Access restriction: Class is not accessible due to restriction on required library"; error message may be shown while developing Java projects in Eclipse IDE. Error message is self-explanatory, some classes can not be loaded into the project since restriction rules are being imposed on those classes.
How to solve
This error message can be removed by changing a setting inside Eclipse IDE. Open up the dialog box shown below, using any of the following paths.
- Windows -> Preferences -> Java -> Compiler -> Errors/Warnings
- (Project) Properties -> Java Compiler -> Errors/Warnings
Locate the "Forbidden reference (access rules)" option under "Deprecated and restricted API" section in the dialog box. This option decides how to handle access rules defined inside Eclipse. By default it is set to "Error" which causes Eclipse to complain about references to any restricted classes. Choosing any other option (Warning or Ignore) will remove these error messages.
"Warning" or "Ignore" options will only hide the potential issue in the project, by allowing the project to use any classes ignoring predefined access rules. To completely resolve this issue, analyze the project and located the use of restricted classes and take necessary actions (either remove those references or access rules).
分享到:
相关推荐
sun.misc.BASE64Encoder找不到jar包的解决方法?... Access restriction : The constructor BASE64Decoder() is not accessible due to restriction on required library C:\Program files\java\jre6\lib\rt.jar
Access restriction: The type JPEGImageEncoder is not accessible due to restriction on required library C:\Java\jre1.6.0_07\lib\rt.jar 此时解决办法: Eclipse默认把这些受访问限制的API设成了ERROR。只要...
1. Access restriction:在Eclipse中编写Java代码时,使用了BASE64Decoder,但Eclipse提示:Access restriction : The type BASE64Decoder is not accessible due to restriction on required library C:\Program ...
EDM安全存取主要通过两种控管方式来实现安全存取的控管,分别是debug access indication(调试访问指示)和EDM access restriction(EDM访问限制)。 1. Debug Access Indication(调试访问指示) 这种控管方式提供...
SIB3包含了UTRAN mobility information elements、Cell Selection and Re-selection info、Cell Access Restriction等信息。 SIB5/6:公共物理信道参数信息 SIB5和SIB6包含了公共物理信道的相关参数,SIB5主要是...
* 访问限制选择(access restriction),选择enable时可以设置允许或不允许访问的MAC地址 知识点7: 高级Wireless设置 * 可以设置Wireless信道、数据传输速率、RTS阈值等高级参数 AP无线配置无线局域网需要注意AP...
在提供的文档"Eclipse Access restriction.docx"中,很可能详细介绍了如何执行这些步骤,并提供了实际的示例和最佳实践。这将帮助开发者理解如何在实际项目中应用访问策略,以保护系统安全性和合规性。 总的来说,...
当出现"Access restriction: Class is not accessible due to restriction on required library"错误时,这通常是因为Eclipse的访问限制规则。要解决这个问题,可以通过以下步骤将错误级别改为警告: - `Windows -...
在错误信息中,我们看到 "Access restriction:The type JPEGCodec is not accessible due to restriction on required library C:\Program Files\Java\jre6\lib\rt.jar",这表明你尝试访问的 `JPEGCodec` 类受到了...
- 信息访问限制(Information access restriction):确保只有授权用户才能访问敏感信息。 - 安全登录程序(Secure log-on procedures):指的是确保用户在访问系统时身份验证过程的安全性。 - 密码管理系统...
然而,在使用Eclipse开发环境中导入这两个类时,可能会遇到访问限制错误:“Access restriction: The type JPEGImageEncoder is not accessible due to restriction on required library C:\Java\jre1.6.0_07\lib\rt...
- 默认情况下,MAC地址限制功能是禁用的(Disable WLAN access restriction),需要手动启用并添加允许接入的MAC地址列表。 以上是基于美国Ruckus无线AP ZF2942型号产品提供的详细配置步骤和说明。按照这些步骤操作...
Access restriction: The type JPEGImageEncoder is not accessible due to restriction on required library C:\Java\jre1.6.0_07\lib\rt.jar ``` **解决方案:** 1. **调整Eclipse配置**:Eclipse默认将这些受...
5. **SIB3**:该信息块包含了小区选择和重选的相关参数,包括Cell identity(小区标识),Cell selection and re-selection info(小区选择和重选信息),以及Cell Access Restriction(小区访问限制)。这些参数...
例如,`Access restriction`错误是由于JRE的访问限制导致的。解决这个问题的方法是在项目构建路径中删除有问题的JRE库,然后重新导入。另一种方法是将错误级别设置为警告或忽略。 另一个可能遇到的错误是`...
2. **ARD(Access Restriction Data)**:访问限制数据,用于控制用户在特定区域或条件下的网络访问。 3. **(CS)Allocation/Retention priority**:电路交换分配/保留优先级,决定在资源有限时哪些用户优先获得...
EDM安全存取有二种的控管方式:debug access indICation和EDM access restriction.种控管方式(debug access indication)提供了一个sideband signal用于指示从调试器(Debug host)的请求。第二种控管方式, 控制...
1. WHMCS预配置将IONe主机添加到WHMCS API白名单路径是: Setup -> General Settings -> Security -> API IP Access Restriction添加产品组小路: Setup -> Products/Services -> Create a New Group然后,添加一个...