See the NB javadoc for InstalledFileLocator. Using that, you should be able to put together the classpath you want. For example,

   File aJar = InstalledFileLocator.getDefault().locate(
        "modules/ext/something.jar", "com.here.you", false);

-ernie

On 2/5/2020 6:40 PM, Michael Wiedeking wrote:

Hello.

From within my plugin I need to start an external process running a Java program which needs some of my modules.

Is there a way to retrieve a (runtime) classpath which contains all the locations of my modules' JAR files (including all the needed NetBeans modules)?

Thanks,

M.

[Clarification: My plugin is defined by modules M1, M2, and M3 which need the NetBeans modules N1, N2, and N3. Module M3 defines a class C with a main method. My modules are either used as a NetBeans plugin or run as an RCP application. An action requests M2 to start an external Java process which starts with main class C and needs at least modules M1 to M3 and N1 to N3 on its classpath (resp. module path). Is there a way to access the classpath CP of the running NetBeans instance which would provide a list of all used modules such that the process

                java   -classpath CP   C additional_arguments

might be started, where CP is something like

/a/x/M1.jar: /b/y/M2.jar: /c/z/M3.jar: /h/r/N1.jar: /i/s/N2.jar: /j/t/N3.jar

This classpath must not necessarily be limited to the list of enumerated modules; it might additionally contain M4 to Mn from other plugins and NetBeans modules N4 to Nm. Note that in the regular case only the name of the class C (and the fact that it resides in one of the running modules) is known.]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to