views:

277

answers:

1

Hello i'm trying to develop an eclipse plugin (in eclipse) that uses the Java debugging interface and i'm getting the following error:

Access restriction: The type VirtualMachine is not accessible due to restriction on required library /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/classes.jar

Using the debug interface in a non plugin development project seems to work fine. I think it has something to do with the plugin dependencies but i'm not sure how to fix it.

+2  A: 

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.

Source: http://lkamal.blogspot.com/2008/09/eclipse-access-restriction-on-library.html

Cuga
Great, worked for me, thanks. My advice is to always choose the second path (which Eclipse even offers with a link for project-specific settings on the last screen of the first path): this error is due to some code accessing classes that, in an ideal world, it shouldn't (in my case, it was 3rd-party code used to access an external service - classes I don't want to touch anyway). By limiting this setting to the current project, one avoids fostering such violations in the future.
chester