File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes IDEs, Version Control and other tools and the fly likes Access restriction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Access restriction" Watch "Access restriction" New topic

Access restriction

deepa anandan

Joined: Jun 06, 2006
Posts: 24

I am using a class BasicNewProjectResourceWizard but the following error is being reflected:

Access restriction: the type BasicNewProjectResourceWizard is not accessible due to restriction
on required library D:\Middleware SDK\eclipse\plugins\org.eclipse.ui.ide_3.1.1.jar

Please let me know how to solve this error??
deepa anandan

Joined: Jun 06, 2006
Posts: 24
Included the package name under Imported Package in Dependencies.
As a result the error is not there but once the application is run...the following error are generated:

java.lang.NoClassDefFoundError: org/eclipse/ui/wizards/newresource/BasicNewProjectResourceWizard
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at org.eclipse.osgi.framework.adaptor.core.DefaultClassLoader.defineClass(
at org.eclipse.core.runtime.adaptor.EclipseClassLoader.defineClass(
at org.eclipse.osgi.framework.adaptor.core.DefaultClassLoader.findClassImpl(
at org.eclipse.osgi.framework.adaptor.core.DefaultClassLoader.findClass(
at org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader.findLocalClass(
at org.eclipse.core.runtime.adaptor.EclipseClassLoader.basicFindLocalClass(
at org.eclipse.core.runtime.adaptor.EclipseClassLoader.findLocalClass(
at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(
at org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at org.eclipse.ui.internal.PluginAction.runWithEvent(
at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(
at org.eclipse.jface.action.ActionContributionItem.access$2(
at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(
at org.eclipse.swt.widgets.EventTable.sendEvent(
at org.eclipse.swt.widgets.Widget.sendEvent(
at org.eclipse.swt.widgets.Display.runDeferredEvents(
at org.eclipse.swt.widgets.Display.readAndDispatch(
at org.eclipse.ui.internal.Workbench.runEventLoop(
at org.eclipse.ui.internal.Workbench.runUI(
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(
at org.eclipse.core.internal.runtime.PlatformActivator$
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(
at org.eclipse.core.launcher.Main.basicRun(
at org.eclipse.core.launcher.Main.main(
deepa anandan

Joined: Jun 06, 2006
Posts: 24
I have added the jar org.eclipse.ui.ide_3.1.1.jar [ which contains the class org/eclipse/ui/wizards/newresource/BasicNewProjectResourceWizard ] under plugn.xml-> Dependencies -> Required Plugins.
Added org.eclipse.ui.wizards.newresouce under plugin.xml-> Dependencies -> Imported Packages.

Please do reply why inspite of adding these jars to the path where the classpath setting has to be done???
To get rid of the error.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

Moving to our "IDEs" forum; plugin dependencies are an Eclipse-specific black art.

[Jess in Action][AskingGoodQuestions]
deepa anandan

Joined: Jun 06, 2006
Posts: 24
Is it because its given that BasicNewProjectResourceWizard is not intended to be subclassed???
Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

Originally posted by deepa anandan:
Is it because its given that BasicNewProjectResourceWizard is not intended to be subclassed???

Exactly right. You can probably get around this if you set certain properties on your runtime that wont do strict package checking. Off hand I don't know what they are, but you are correct that this is internal class not meant to be subclassed.

Its EPL so you can copy and paste the whole code so long as you make the result EPL. It would have had to be EPL anyway since you are extending it.
deepa anandan

Joined: Jun 06, 2006
Posts: 24
But I m reported with the same error for another set of classes if I am accessing them.

I am trying to use a plugin within my plugin.
When ever i try using the class present in another plugin i am reported with access restriction error.
In Java build path under plugin dependencies - access restriction forbidden is **/*.
Is there any way I can change the access restrictions???

Tried another method too deleted the plugin dependencies and imported all the jars but still 4 build path entries are missing. couldnt trace what exactly is the problem???
I agree. Here's the link:
subject: Access restriction
It's not a secret anymore!