How do I reference libraries in NetBeans? - java

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?

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.

The best solution is to edit project.properties file and replace below piece of code.
Original property: endorsed.classpath=\${libs.JAX-WS-ENDORSED.classpath}
Replace with: endorsed.classpath=\${lib.JAX-WS 2.2.classpath}
In older versions of Netbeans there is JAX-WS-ENDORSED library in libs location.
Newer versions of Netbeans having JAX-WS 2.2 library in lib folder
** ALL THE BEST **

If it is still needed, I had the same situation when opened a netbeans 6.9 project in netbeans 7. There is no way to resolve the 'jaxb-endorsed' (in my case was jaxb and not jaxws) reference using the libraries window.
I found a endorsed.classpath property in the nbproject/project.properties file.
I still not sure what is its purpose, but in this property I found the bad reference to jaxb-endorsed.classpath, so I deleted, closed netbeans and opened again, and the reference problem has gone.
I already have Jaxb 2.2 library added to my project, so it is working good with the modification I did to the project.properties.
I hope it helps.

I had a similar problem : DO NOT DELETE THE JAX-WS-ENDORSED - remind me to downvote. I had to go to the imported project > resolve reference
problems dialogue > delete the references from there which were pointing to the old NB folders - pic :
and then create the throwaway web service as suggested by William Scott and then add the newly created jars :

Netbeans maintains a set of libraries, which are simply a convenient way to manage groups of related jar files. Start by clicking Tools > Libraries. You will see the library manager window.
You will see the options to add your own libraries if you have jar files downloaded. If you do not see the library that you are looking for you can download them and add them your self. Once the library exist in Netbeans you can go to the Project Explorer window and right click on the Libraries tab of your project. Select Add Library and you will have the chance to add the library that you added in the library manager.

You may want to right click on your project, go to properties -> Libraries.
Remove the JAX-WS-ENDORSED library, and try using JAX-WS 2.2
Also remove metro and try adding METRO 2.0
That may solve your problem.
You may also want to right-click on your web service references and select
Edit Web Service Attributes
Then on wsimport Options tab see if xendorsed is set to true.
UPDATE
You may need to close netbeans and then open it again, and it may work. I was having a problem similar and I just did that and it worked.
The only difference, and it may not be needed, is that I also added the JAXB 2.2 library, but that was because I was trying to solve a compilation error.

I had same problem and Fix it by install soap webservice and and resful webservice in netbeans plugin

I fix it:
unistall netbeans.
delete HOME/.netbeans and HOME/.nbi
then install netbeans again

Old thread, different and effective solution... I just moved some projects from one system to another and got this error. With NetBeans v7.3+, go to Tools>Plugins, Available Plugins, then search for "SOAP". You should see "SOAP Web Services". On loading this library you'll get the JAX-WS-ENDORSED library. Restart NetBeans and you should be able to get a Clean Build.
Loading this package brings in a number of other libraries. On restarting the IDE you may get a notification that other packages now have available updates.

Do the following ( BTW in my case its NetBeans 6.9.1 )
1 Why this appeared now ?
Because i tried to open project on other pc with fresh copy of net bean
2 How the problem looks like ?
Jar Lib Not Found for JAX-WS-ENDORSED
3 Why it was needed at the first place and what its used for?
Well i have a webservice on same server/domain e.g localhost , so of course
it will work if i removed the web service from the folder in sources but i need it
4 What to do?
Try to add dummy any online free web service in form wsdl
like Some test web service or search for any other one
This is the source of my public free to use wsdl
5 What then ?
Just add it please
Now what ?
Wait for scanning project stuff it should be ok
you can re check from library properties of project
or see that there is no red/ or resolve references problem
in project properties
So what happened exactly?
Note: JAX-WS-ENDORSED it will be added automatically to your libraries
same methodology can solve other problems as well

Related

After creating android project in Eclipse ADT, tons of errors show up

I'm using eclipse ADT (most recent version) to develop some android apps. I've followed the getting started tutorial at the dev.android.com and it worked just fine.
But when i tried to create another project with the same targets and sdk's, i've got nothing but errors:
Some errors and my sdk's:
That's the same sdk's i used before these errors started showing up.
What can be causing this?
EDIT: my project won't generate the R.java file
You might need to add a support library to your new project.
Check this link for downloading the support libraries -
http://developer.android.com/tools/support-library/setup.html#download
Please notice that you need to import them into your eclipse and then include one (preferably the newest, not sure about this) in your project.
EDIT:
Before downloading the support libraries you should first check if you have them already.
Try this, right click project folder in the eclipse package explorer, Properties>Android>Library>Add>select a library if you have one.
There might be an invalid library included in your project already, if that happens then you will see it in the Library>Add> menu, remove it and add a new one.
You might have clean your project ........
if yes.....you must check whether R.java file is present in **Project(your project)->gen->package name->R.java**
if not than u have to update Tool Folder in SDK manager

Error: Archive for required library cannot be read or is not a valid ZIP file.

I am having trouble setting up the build path of my java project. I am currently in a Co-Op IT position so I am somewhat new to all this. My background is mostly in C++ and I am learning java on the fly. I am also somewhat new to Eclipse (Kepler service release 1).
I am working on a bug on an existing program and need to get the program to build so I can work on it. When I add all of the external .jar files that I know for a fact are the right ones, I am getting this error on two of them :
"Archive for required library: '(location of file)' cannot be read or is not a valid ZIP file"
Two of the other full time guys on my team have gotten the program to run with those exact same .jar files, one running Eclipse Indigo and the other running the same Kepler version as myself. I also was able to open the two .jar files manually and everything appears to be there. After every trial trying to fix this, I have refreshed, cleaned and restarted eclipse. The two other full time guys said they have never seen this error. I would like to get some insight on this from anyone who has any similar experiences so that I don't have to use up much more of their time.
I Had this issue, just fixed by deleting .jar files from Libs directory then copy->paste original Jars again. Then do a complete clean -> rebuild
I got this problem, took help from following link solution
which basically says to
1. delete the corresponding maven download folder
2. maven>update project in eclipse
In my case I deleted hibernate folder, since i was getting error related to hibernate-validator.jar
I had the same error here. What I did to resolve the problem was close and reopen the project.
I got the same problem and found out the root cause is the JDK in my linux shell is set to 1.6, but in the eclipse, the JRE is 1.7.
Using Eclipse without m2e features (Standard Edition) helped me.
Similar problem with Spring toolsuite
Just came across this link that shows a way to get unblocked.
In preferences dialog box go to
Java->Compiler->Building
and change Incomplete build path to "Warning" (from default "Error")
This can be done globally (for all projects), or on a project by project basis.
Check the jar's file permissions/ownership.
I had the same issue on eclipse installed on Linux and fixed it by setting the file permissions right.
In my case ..worked after removing this from spirngrest-servlet.xml file.
<prop key="net.sf.ehcache.configurationResourceName">/Sysehcache.xml</prop>
I think it had to do with default location of maven repository of jar files.
Been at it for 3 days. finally solved it.Hope it helps anyone.Just look for similar think in your spirngrest-servlet.xml file. Good luck.
I just tried the following and it worked:
Close eclipse as there might be some files eclipse is accessing and you won't be able to delete.
Delete all the libraries installed in the maven repositories folder: ".m2/repository"
Open eclipse and update your project(Alt+F5).
What did we just do? : This is possible that the existing libraries in the local repository are erroneous and maven tries to open which it fails in. We have now deleted the already existing library and with the project update, Maven will download the library again which should resolve the issue.
i fixed this by just deleting everything inside of the /Users/username/.m2/repository folder. not the repository folder itself. and then running a mvn clean package in the project folder

Implement Growl in Java Application

I want my Java application to make a growl notification. My IDEs are Eclipse and Netbeans, and I am trying to implement a library in either (so far it worked it neither). How can I just add the library to my project and then reference the classes from within my own classes? Moreover, where can I find an appropriate library?
Thanks in advance!
EDIT: Ok, now I have somehow managed to implement the library ^^ However: the following command fails:
System.loadLibrary("growl");
It returns following error:
Message: no growl in java.library.path
How can I fix this?
About an appropriate library you should just google it. I found this one (that is tested on 10.5 so maybe it will need some tweaks): http://www.cocoaforge.com/viewtopic.php?f=6&t=17320
To add the library to your project in Eclipse copy it into the project folder (this is not necessary, you could just copy it wherever you want, also in extension folder of the JDK) and then add it through the project settings:
open project properties by right clicking the project and choosing Properties
go to Java Build Path option
go to Libraries and add it
It's possible to use AppleScript script engine in Java 6 on OS X to communicate with Growl. Here's a blog post describing how to do it.
You can use the network binding like in https://github.com/chamerling/JavaGrowl or https://github.com/aerofs/growljavabindings
Maybe this can help you.
If your classes are packaged in a JAR file, just like a 3rd party library, you should be able to put it in your project /lib directory and add it to the CLASSPATH using the IDE. That should be all you have to do (if I understand your question correctly).

Package <blah> does not exist error - NetBeans 6.8 & Windows 7

I'm using NetBeans 6.8 on Windows 7. I upgraded from WinXP and NetBeans 6.7. Now my existing java web app project is no longer able to import/find the packages I've developed - I receive a 'Package ,blah. does not exist' and yet the packages do exist, worked fine in NetBeans 6.7 and the project still compiles and runs OK.
I've tried changing the Java Platform/JDK from 1.6.0_10 back to JDK 1.5.0_22 but I still receive errors package does not exist.
All other 'standard' libraries and packages are able to be imported and used OK ... eg Struts, Hibernate
I have fixed this problem many times by clearing the NetBeans cache.
1) Close NetBeans
2) Go to "C:\Users\.netbeans\6.8\var\cache
3) Delete everything that is in this directory
4) Open NetBeans and wait for it to re-scan your projects
At this time, this has fixed my problem. I do need to do this every once and a while, but if I don't change anything in the project's structure, the issue does not come back, and I can develop in peace!
Hope it helps someone in need.
Solution was to create a new empty web application, check the existing project out from SVN, regenerate the build-impl.xml & configure the library references.
All is now importing and referencing OK
I do not have an explanation as to why the problem occurred the first time this project was created
I had the same issue with Netbeans 7.0.1. Suddenly after some work I could not compile my project anymore, because a major package "does not exit" anymore. All my projects settings (build properties, project properties, dependencies ) seemed ok for me.
The only (bad) solution I could find is, to copy the relevant module to a new name, remove the old and re-create the module again by copy/paste of packages. Now it works again.
regards
I have seen the error when I had the same jar installed twice - as compile library and as a test library.
As the result, many of packages became invisible.
After removing the jar from compile libraries everything become visible.
In the project Properties, under "Libraries", "Compile" tab. Do an "Add jar/folder" of the "src" directory if it's a regular Java project. If it's JSF, use "src/java" instead.
just change s by S in System.out., is simple but i think is your problem

Android Eclipse Classpath - want to add classpath container path but eclipse won't let me

I'm using Eclipse to learn to develop Android applications in Java. I haven't used Eclipse before.
The project I'm trying to use (supplied by OReilly as part of 'Android Application Development') is MJAndroid. When attempting to run the project, the Run fails, and the Problems tab mentions com.java.Object can't be found, and Eclipse asks me to check the build path. Clicking
Properties -> Java Build Path -> Libraries, the message 'Unable to get system library for the project' is displayed.
On a working project, Properties -> Java Build Path -> Libraries has an entry for Android 1.1, which if I click Edit, has the classpath container path of com.android.ide.eclipse.adt.ANDROID_FRAMEWORK.
It seems a simple matter of adding the correct container path to my non-working project. However Eclipse seems determined to make this as difficult as possible. No matter what I chose to add - jars, externals jars, variables, libraries, class folders, external class folders, nothing seems to take the form of 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK' that the 'Android 1.1' entry on the working app has.
How can I add this namespace to my project so it resembles the working one?
I'm quite sure it's a problem with Eclipse's somewhat odd user interface. Frankly there' nothing I'd prefer more than a file to modify and set such information - my background is in Python, and the whole eclipse environment seems an unnecessary burden.
I had faced the same issue when I imported a sample code downloaded from the internet. I am using android sdk 1.5 with 0.9 ADT plugins. Here is a simpler way to fix the andoid library reference issues
Right click on the project which has
issues and select properties
Select the appropriate Android build
(1.1, 1.5 or 1.5 with google api) and
say ok
Again right click on the project and
select "Android Tools > Fix Project
Properties"
Fix the imports once (if required)
Refresh the project and you should be
ready to go without any manual
editing
I faced this same problem after importing a project through GIT. The problem was that I didn't have the same target android platform installed, and the build path somehow got corrupted.
The first obvious thing i did was changing the target sdk in the project.properties, but even after cleaning up the project and Android Tools > Fix Project Properties, it didn't help and I was still getting the build error.
My solution after wasting close to 1 hour trying to figure this out?
RESTART ECLIPSE
Everything worked fine after that. Eclipse is pretty fickle. Only through years of experience you'll then understand her well. :)
Had the same problem and it turns out the Android SDK Location was not set which was a really simple fix. Go to Window->Preferences, click on 'Android' on the left hand menu, fill in the location of the Android SDK (e.g. C:\Program Files\Android\android-sdk) and click OK. Everything worked fine for me after that.
Found the answer in this set up guide: http://developer.motorola.com/docstools/library/Installing-Android-Dev-Environment/
Sometimes Eclipse can get a bit funny (technical term) with classpath container resolution.
You have a working project in your workspace, so you can rule out plugin installation issues. You could try opening the .classpath file (hidden by default, select the triangle in the top-right of the Package Explorer view, select Filters... and uncheck .* resources) and manually adding the container declaration.
`<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>`
You may then have to close the project and open it again (right-click->Close Project) before Eclipse recognises the change.
You may also find that there is an Android builder and/or nature. If you compare the .project files for the working and non-working versions you may see entries for Android builders/natures. Copying the relevant entries may resolve the issue.
sometimes, eclipse can help you.
In Android projects, click right button on the project-> Android Tools -> Fix Project Properties.
It's usefull in class path errors!!
Luck!
I would verify you have the correct version of Java installed as well as the Android SDK. I would recommend installing/reinstalling the ADT plugin in your eclipse, makes it alot easier to create the android project.
http://developer.android.com/sdk/1.5_r2/installing.html
Also. I guess the path of the Android SDK must be setup correctly. This happened when I was overloaded with projects and I decided to create a new workspace copying some existing stuff into it.
Seems that the new workspace requires you to setup these details too once again
Is that setup properly?

Categories

Resources