0

I develop a simple plugin for netbeans platform. I wonder how can i get a classpath of specify java project (for example i have opened two WebJavaProject) and now i dont know how can i get a classsLoader for specify project.

Im trying something like but this dosent work:

      FileObject f = this.project.getProjectDirectory();
      ClassPath cpCompile = ClassPath.getClassPath(f, ClassPath.COMPILE);
      cpCompile.getClassLoader(true);

can any body know how can i get it?

Michał Ziembiński
  • 1,124
  • 2
  • 10
  • 31

1 Answers1

0

You need to look for a more specific classpath. One project will usually contain classpath for sources and classpath for tests. If you start from a project you probably want to access its Sources or SourceGroups (check ProjectUtils.getSources(org.netbeans.api.project.Project) and JavaProjectConstants.SOURCES_TYPE_JAVA). This will give you source roots and there will be classpath associated with them.

Radim
  • 4,721
  • 1
  • 22
  • 25