This means

  1. your module is trying to use a class, but your module does not declare a dependency on the module that provides that class...or
  2. you are declaring a dependency on the right module, but you are accessing a class that is not in one of the packages that module says are public (for use by other modules).

If the problem is 1, you need to declare a dependency on the module where the class is (remember that all of NetBeans APIs are modules, and in separate jars - so if it's the IO API, that's a module -, if it's the Window System, that's a module - so forth).

If you're using NetBeans 5.0 or later, setting dependencies is easy - open the Properties for your project, and choose the Libraries page. Click Add and a small dialog opens - just type the name of a class you need to use, and it will filter the list to find the module that provides that class - so you don't have to memorize a huge list of mappings from classes to modules.

If it's problem 2, then you are already declaring a dependency, but get full access to all classes in a module, you need to declare an implementation dependency. Be sure you really need to use the class you're trying to use, in this case - it will make your module hard to upgrade because generally it will need to be paired with the exact version of the other module's jar that it was built with - if that module is upgraded, your module may end up being disabled.

For a nice way to resolve all module dependencies at once, to force all of the errors to be exposed simultaneously, just add the following to the command line when starting NetBeans:


The message displayed states that when using this flag, you should not use the -J-Xverify:none flag (often specified in the IDE configuration file), so you may need to edit the .conf file to remove the -Xverify option before using the pre-resolve option.

In the (currently unreleased) 5.0 Update 1 version of the build harness, you will get compiler errors rather than runtime errors if you try to use classes from non-public packages without an implementation dependency.

Source: NetBeans FAQ

Parent Category: Other API Tips