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.
How did you specified those 3rd party libraries? Thanks,
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
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: http://www.lowagie.com/iText/download.html
- JavaMail: http://java.sun.com/products/javamail/downloads/index.html
2. Get hold of a schema (XSD), in this example i went to http://www.w3schools.com/Schema/schema_example.asp 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
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
I cannot still reproduce it. I've followed the step to reproduce, but everything works fine for me. Can you attach
sample project, please?
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
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?
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
Created attachment 73932 [details]
Here is another sample app using a different library (Apache commons-lang)
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 JavaApplication6.zip
yes, the problem is reproducible with the provided project. the recreating of jar does not help
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,
project.properties 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.
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
- 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.
Actually my workaround did not help, next time I closed and re-opened netbeans the projects were back to the old problem
Duplicate of issue #153727, IMO.
*** This issue has been marked as a duplicate of 153727 ***
Downloaded latest nightly build which included fix for 153727, issue remains.
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.
There have been changes in the handling of sources generated by JAXB, JAX-WS etc. Could the situation be improved in the
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.
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
I really hope this can be fixed before 7.0 (which is the target milestone)
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.
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.
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
I just tested NB 7.01M and its seems that this release resolved my GWT library reference issues.
The problem still remains in NB7.0 M1 when using JAXB binding
M1 is too old and does not contain these changes. Can you please try the latest daily build:
or the latest continuous build: http://deadlock.netbeans.org/hudson/job/trunk/ ?
I tried this http://bits.netbeans.org/dev/nightly/ build and it seems that it has been fixed. Great!
Closing the issue as Jesse's and Milan's changes in latest NB7 build fixed the issue as reported by the user.
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 nextapp.echo2.app 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.
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.
>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.