Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 151994 - Added Libraries not being seen by IDE compiler
Added Libraries not being seen by IDE compiler
Product: webservices
Classification: Unclassified
Component: JAXB
All All
: P2 with 6 votes (vote)
: 6.x
Assigned To: _ gmpatil
Depends on:
  Show dependency treegraph
Reported: 2008-10-31 15:18 UTC by adeanva
Modified: 2010-01-04 05:37 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT

Here is the resulting broken project. Because of size constraints it only has one external library which was added after the JAXB Binding. I created this one in 6.1 (968.53 KB, application/x-compressed)
2008-11-13 21:56 UTC, jamesweakley
Here is another sample app using a different library (Apache commons-lang) (506.67 KB, application/x-compressed)
2008-11-20 00:49 UTC, jamesweakley

Note You need to log in before you can comment on or make changes to this bug.
Description adeanva 2008-10-31 15:18:53 UTC
I have a Web Service project in Netbeans 6.1 that includes 3rd party libraries imported into the project. (For example,
the geoTools libraries)

When I open the project in Netbeans 6.5 RC2 (and previously in RC1) the imported libraries are not seen by the IDE for
code checking.  Any Java class which imports from the libraries is red-flagged as Package does not exist.  The ant
script successfully builds the project.

I've seen some reference to this issue in the forums, and I've cleared the var/cache, but no solution was given.

I'm using Jdk 1.6.10 to run Netbeans, but the project uses Jdk 1.5 to build the project.
Comment 1 Jan Becicka 2008-11-12 13:46:30 UTC
How did you specified those 3rd party libraries? Thanks,
Comment 2 adeanva 2008-11-12 14:44:21 UTC
Under the project Project Properties dialog, under Libraries, I used the "Add JAR/Folder" function to individually add
the jar files to the lib/other folder.  The project is setup to use a Library folder.  This was done in Netbeans 6.1. 
In 6.5, I see the libraries listed under the project Libraries, and the ant build works.
I have not tried to reload the libraries in 6.5, I just went back to using 6.1
Comment 3 jamesweakley 2008-11-12 22:34:42 UTC
This is an annoying one for me, I've started encountering it when JAXB is involved, and I've seen it in version 6.0, 6.1
6.5Beta, 6.5RC and nightly build 200811071401 (the latter is used in this example). Steps to reproduce:

1. Get hold of 2 library jars. In this example I used:
   - IText:
   - JavaMail:

2. Get hold of a schema (XSD), in this example i went to and used the
third design of the schema file and saved it as shiporder.xsd 

2. Create a new Java application

3. Add a library in (go to project properties, libraries tab, add JAR/folder)

4. Import some part of the library in the main class, should have no problems.

5. Add a new JAXB Binding for the schema file (Right-click the project, new, Other, XML, JAXB Binding, and use any
package name)

6. Now add a second library into the project

7. Add an import for the second library into the main class. It gets a red underline with the package "does not exist",
even though the project will build successfully

8. Even if you delete the JAXB Binding, the problem remains

I can only guess that the JAXB Wizard makes some permanent change to the library configuration which causes the newly
added libraries to not be seen by the IDE, but the change does not affect the build script
Comment 4 Jiri Prox 2008-11-13 11:30:50 UTC
I cannot still reproduce it. I've followed the step to reproduce, but everything works fine for me. Can you attach
sample project, please?
Comment 5 jamesweakley 2008-11-13 21:56:09 UTC
Created attachment 73754 [details]
Here is the resulting broken project. Because of size constraints it only has one external library which was added after the JAXB Binding. I created this one in 6.1
Comment 6 jamesweakley 2008-11-13 21:59:58 UTC
And by broken I mean the IDE tells me the javax.mail.* package cannot be found, but the ant build target is successful.
adeanva: does your project contain any JAXB Bindings?
Comment 7 Jiri Prox 2008-11-18 12:43:52 UTC
Thanks for project, I can see it now. The problem is in the mail.jar, I've tried to use it in another project (w/o jaxb)
and got the same error. After decompressing and recreating the jar again, all starts to work fine
Comment 8 jamesweakley 2008-11-20 00:49:38 UTC
Created attachment 73932 [details]
Here is another sample app using a different library (Apache commons-lang)
Comment 9 jamesweakley 2008-11-20 00:52:32 UTC

I still have the problem even using a different library. I did the same thing as before, but used the Apache
commons-lang jar instead of JavaMail. Same problem: Red underline, builds fine.

This is the attached
Comment 10 Jiri Prox 2008-11-20 12:21:48 UTC
yes, the problem is reproducible with the provided project. the recreating of jar does not help
Comment 11 jamesweakley 2008-11-20 20:53:40 UTC
Yesterday I had some success with the broken project. If you save a copy of the NBProject directory before adding a JAXB
Binding and then diff it afterwards you can see the changes it makes (from memory it was in build-impl.xml, and a new file included in build.xml). These changes remain even after the JAXB Binding is removed,
and it is these that seem to prevent newly added libraries from being seen by the IDE. Once I removed these manually I
was able to re-add the library and there were no errors.

I started the process again so that I could narrow down which change was the cause, but for some reason I couldn't get
the same success a second time. So unfortunately at this stage I only have this vague description.
Comment 12 jamesweakley 2008-11-25 05:08:47 UTC
Here is a workaround that seems to work for me:
- Note the settings for JAXB Bindings in the project. I just right-clicked on each binding, hit "Change JAXB options"
and took a screenshot.
- Make sure you still have the original schema file. If not, copy it out of xml-resources\jaxb to somewhere outside the
project dir.
- Delete the JAXB Bindings
- Note which libraries you are using in your project. Go to project properties, remove them all, and then re-add them.
- Close netbeans, delete your cache from $HOME/.netbeans/var/cache and go back to netbeans.
- Re-create your JAXB Bindings.
- Check that project builds successfully.
- It may take a while, but eventually the errors should all disappear.

This workaround reinforces that the JAXB bindings are preventing new libraries from being noticed by the IDE.

I would be interested to know whether that works/doesn't work in other projects.
Comment 13 jamesweakley 2008-11-25 21:42:09 UTC
Actually my workaround did not help, next time I closed and re-opened netbeans the projects were back to the old problem
Comment 14 Jan Lahoda 2008-12-03 22:09:31 UTC
Duplicate of issue #153727, IMO.

*** This issue has been marked as a duplicate of 153727 ***
Comment 15 jamesweakley 2008-12-12 06:02:46 UTC
Downloaded latest nightly build which included fix for 153727, issue remains.
Comment 16 Tomas Zezula 2008-12-12 07:33:45 UTC
Probably the same as issue #153727 but in another SourceForBinaryQueryImplmentation instance. The jaxb SFBQ seems to corrupt the project's SFBQ.
Until the binding is added to the project the project's SFBQ works fine.
Comment 17 Petr Jiricka 2009-02-06 10:51:58 UTC
There have been changes in the handling of sources generated by JAXB, JAX-WS etc. Could the situation be improved in the
latest builds?
Comment 18 shay1680 2009-02-09 13:21:07 UTC
Hi ,

i see the same problem with netbeans 6.5 and GWT, as soon as i added another library , editor doesn't see the GWT files

I believe that this issue makes the IDE unusable , as it is impossible to understand which errors are false positives.

is there a workaround?

can the priority for a fix increase?

after 3 days with this issue , i see no solution except to switch to Eclipse, any advice would be much appreciated.

Comment 19 janir 2009-02-09 16:37:29 UTC
I am also struggling with this, I hope this bug can be fixed as soon as possible (hopefully in patch3)
You can get the IDE to recognize the libraries, the problem is that when you exit the IDE and start it again, it can not
find the libraries anymore. The only workaround I can think of is to put your computer to hibernate at the end of the
day :-)
I really hope this can be fixed before 7.0 (which is the target milestone)
Comment 20 shay1680 2009-02-09 16:53:51 UTC
Hi Janir,

can you please tell me what workaround you found for getting them recognized(at least as a temp solution).

i tried removing , adding , restrating, but no luck.

also , if we can get more votes ,maybe  the priority will become higher.

Comment 21 _ gmpatil 2009-02-09 18:15:38 UTC
As Petr mentioned, there were some changes done related generated sources in NB 7.
I have not got the chance to verify in NB7, hopefully I will be able look into do this week.

Comment 22 janir 2009-02-09 19:37:42 UTC
It works for me when I remove the JAXB binding, close the IDE, restart the IDE, now the external libraries are
recognized. The I just recreate the JAXB binding and it works
If I now close the IDE and restart it again, the ibatis external libraries in my case are not recognized
Then I have to do it all over again to fix it
Comment 23 shay1680 2009-02-09 19:59:44 UTC
I just tested NB 7.01M and its seems that this release resolved my GWT library reference issues.

Comment 24 janir 2009-02-10 18:38:56 UTC
The problem still remains in NB7.0 M1 when using JAXB binding
Comment 25 Petr Jiricka 2009-02-11 08:47:43 UTC
M1 is too old and does not contain these changes. Can you please try the latest daily build:
or the latest continuous build: ?

Comment 26 janir 2009-02-11 16:33:01 UTC
I tried this build and it seems that it has been fixed. Great!
Comment 27 _ gmpatil 2009-02-12 19:44:14 UTC
Closing the issue as Jesse's and Milan's changes in latest NB7 build fixed the issue as reported by the user.
Comment 28 gherson 2009-12-23 11:42:26 UTC
I am new to java and netbeans, so just noting without re-opening this issue that in Netbeans 6.8, function Add Jar/Folder (File - Project Properties - Libraries) of a folder does not seem to work for me.  Compilation failed with e.g. "package does not exist".  I worked around by clicking Add Jar/Folder for every .jar within the directory in question.  

Also, in case this is useful, until I removed that first Add Jar/Folder operation (of the directory named below) I saw in the compilation output:

/home/auser/attempto_java_packages-091207/lib is a directory or can't be read. Not copying the libraries.
Not copying the libraries.
Comment 29 _ gmpatil 2009-12-23 15:23:22 UTC
I think you should add directory only if it is root of the classes/packages. 
Adding directory does not add the jars under it to library or classpath, but you may want to check with Java SE project team in Netbeans user list.
Comment 30 Tomas Zezula 2010-01-04 05:37:49 UTC
>I think you should add directory only if it is root of the classes/packages. 
>Adding directory does not add the jars under it to library or classpath
Yes, you have to add all the classpath roots. The directory is a classpath root only in the case when it directly contains the java packages.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo