How do I reference libraries in NetBeans?

Jay Sullivan picture Jay Sullivan · Jun 1, 2011 · Viewed 45.1k times · Source

I have a Java Web Services project that was created in an older version of NetBeans, and I haven't accessed it in many months, so my paths and installed libraries are different.

When I try to open the project, I get a "Resolve Reference Problems" dialog, and two Reference Problems are listed:

"metro" library could not be found
"JAX-WS-ENDORSED" library could not be found

I have a fresh installation of JDK 6 Update 25 with NetBeans 7.0, and am running Windows 7.

What steps can I take to solve this? I don't even know where to start, as every approach I've taken so far hasn't gotten me anywhere.

Note: JAX-WS-ENDORSED does not appear in my Libraries listing, so I can't remove it. Something hidden is referencing it. How would I find this?

Answer

William Scott picture William Scott · Oct 21, 2011

I just came across this issue and found some help from http://netbeans.org/bugzilla/show_bug.cgi?id=187145. Apparently, Netbeans will create the JAX-WS-ENDORSED library when a new web service is created. So go to File > New File, choose Web Service > Web Service Client and fill in dummy values (this can be done in a throwaway project). This client can then be removed, and Netbeans will have created the library with the following classpath entries:

java/modules/ext/jaxws22/api/jaxws-api.jar
ide/modules/ext/jaxb/api/jaxb-api.jar

These are relative to your Netbeans install directory (on OS X will be located in Contents/Resources/Netbeans within the .app). Alternatively, you could create the library manually using the entries above.

This only needs to be done once, as the library will be added to Netbeans Global Libraries list.