Meaningless Drivel is fun!*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Access restriction" Watch "Access restriction" New topic
Author

Access restriction

deepa anandan
Greenhorn

Joined: Jun 06, 2006
Posts: 24
Hi,

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
Greenhorn

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(DefaultClassLoader.java:370)
at org.eclipse.core.runtime.adaptor.EclipseClassLoader.defineClass(EclipseClassLoader.java:233)
at org.eclipse.osgi.framework.adaptor.core.DefaultClassLoader.findClassImpl(DefaultClassLoader.java:343)
at org.eclipse.osgi.framework.adaptor.core.DefaultClassLoader.findClass(DefaultClassLoader.java:235)
at org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader.findLocalClass(AbstractClassLoader.java:183)
at org.eclipse.core.runtime.adaptor.EclipseClassLoader.basicFindLocalClass(EclipseClassLoader.java:141)
at org.eclipse.core.runtime.adaptor.EclipseClassLoader.findLocalClass(EclipseClassLoader.java:68)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:337)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:389)
at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:350)
at org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader.loadClass(AbstractClassLoader.java:78)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at mPlugin.actions.SampleAction.run(SampleAction.java:55)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:246)
at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:223)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:441)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3125)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2758)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
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(Main.java:334)
at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
at org.eclipse.core.launcher.Main.run(Main.java:973)
at org.eclipse.core.launcher.Main.main(Main.java:948)
deepa anandan
Greenhorn

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
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

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


[Jess in Action][AskingGoodQuestions]
deepa anandan
Greenhorn

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
Greenhorn

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: http://aspose.com/file-tools
 
subject: Access restriction
 
Similar Threads
Access restriction on rt.jar file in Eclipse
troubles importing CachedRowSetImpl
Complete Java 2 Cert Study Guide - Distributed Notification
Access Restriction on Mac (Java 3D)
Import in Java