This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Hi, I am developing a RCP based on NetBeans. This RCP uses ant files to perform several tasks. Since some tasks requires to access to the NetBeans API I use Ant ClassPath extension at runtime by adding <filesystem> <folder name="Services"> <folder name="Hidden"> <file name="org-openide-util-antlibrary.instance"> <attr name="SystemFileSystem.localizingBundle" stringvalue="com.streamsim.hmutils.Bundle"/> <attr name="instanceCreate" methodvalue="org.apache.tools.ant.module.spi.AutomaticExtraClasspath.url"/> <attr name="url" urlvalue="nbinst://org.openide.util/lib/org-openide-util.jar"/> <attr name="instanceOf" stringvalue="org.apache.tools.ant.module.spi.AutomaticExtraClasspathProvider"/> </file> </folder> .... and many more. However if I add to the classpath "org-openide-util.jar" or "org-openide-filesystems.jar" I get a java.lang.LinkageError: Class org/openide/ErrorManager violates loader constraints at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:180) at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:460) [catch] at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151) at runtime. This is really a blocking issue for the company I am working for, because we have the uttermost need to use NB API. Thanks in advance for your help
Using AutomaticExtraClasspathProvider for this purpose is inappropriate. AECP is _only_ for a fixed set of JARs which are used by "optional" tasks bundled in the Ant distribution, which for historical reasons expect their 3rd-party libraries to be available in Ant's own classpath. When loading these JARs normally via <taskdef>, it works for me in a 6.5 dev build; see attached project. If what you really want is for the Ant tasks to access the internals of the running platform - rather than loading fresh copies of NB API modules with no context - then you should be using ant/nblib/*.jar as documented in the Ant integration API.
Created attachment 65576 [details] Sample project