Question

I have a question regarding the use of NetBeans Platform and setting dependencies or simply referencing classes from another module.

What I have:

NetBeans Platform Application with a main module called Viewer

com.demo.viewer
 -MainScreenTopComponent.java

And I have a module named MenuToolbar

com.demo.toolbar
 -menutoolbar.java
 -action1.java

menutoolbar.java has a method that I would like to access from the MainScreenTopComponent.

I have tried right clicking the Viewer module, going to properties >Libraries and adding dependency on the MenuToolbar module, however I still cannot even import the package.

Any help is appreciated =(

Thank You!

Edit: Solved myself. Instead of adding dependency in Viewer, I added a Warpped Jar which I found in my platform's Build/Clusters/Modules folder!

Was it helpful?

Solution

No need to use a wrapped JAR.

You need to export the classes from within the module MenuToolbar:

  1. right click on your module
  2. select properties
  3. click on "API Versioning"
  4. check the package com.demo.toolbar in the list of packages labelled "Public Packages"

This assumes your MenuToolbar module is already part of your NetBeans platform application

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top