• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Netbeans Libraries Question

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am using Netbeans 5 ( release candidate 2 ) and I am trying to add the HTTPClient library found at HTTPClient.

I have a JDialog which uses this library but all references to HTTPClient objects are not working. NB highlights them saying "Package HTTPClient does not exist". This is after I have run "Fix Imports" and after adding HTTPClient as a library object to NB's Libraries folder in the Project view.

I made the library object by downloading the HTTPClient zip, unzipping it into a folder called 'HTTPClient', then making a new library called 'HTTPClient' in NB, then pointing the;

classpath to C:\Documents and Settings\Darren\My Documents\3rd Party Java Libraries\HTTPClient
source to C:\Documents and Settings\Darren\My Documents\3rd Party Java Libraries\HTTPClient
javadoc to C:\Documents and Settings\Darren\My Documents\3rd Party Java Libraries\HTTPClient\doc

Can anyone who uses Netbeans please help me get this library to work as I am clearly doing something wrong.

I have got HTTPClient to work within BlueJ by simply pointing it at C:\Documents and Settings\Darren\My Documents\3rd Party Java Libraries\HTTPClient and using import HTTPClient.*;

Thank you.

Darren
 
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The easiest way to do this would be to Right click your project in the Projects navigation view.

Select properties. A Project Properties Dialog would pop up

Select Libraries on the Tree on the left hand side. Now click Add Jar/Folder button on the right hand side of the dialog.

A File Dialog should pop up. Now browse to the HttpClient folder and select the HttpClient.jar file or what ever it is called.

Please follow the same steps to include the jar's referenced by the HttpClient.jar if any.

Hopefully by now you are all set to compile and run your code.

-Rajagopal
 
D R Wilkinson
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your reply Rajagopal,

The proceedure you describe is what I did first but it didn't work.

If you were to download the HTTPClient zip file, you may be able to see where I am going wrong.

After extracting all the files within it, you will see that the zip file doesn't contain any jar files. The directory structure is...

HTTPClient
|________ ( Files ) Lots of java/class files ( the main ones I need )
|________ ...
|________ ( Folder ) alt
|________ ( Folder ) doc
|________ ( Folder ) http
|________ ( Folder ) https
|________ ( Folder ) shttp

In BlueJ, referencing the root HTTPClient folder is enough for BlueJ to recognize the files within the root folder HTTPClient as being 'importable'.

Netbeans is different though.

As you suggest, I create a new library called HTTPClient then..,

I reference folder HTTPClient for the classpath.
I reference folder HTTPClient for the source.
I reference folder HTTPClient.doc for the javadoc.

In the projects window, I add the new HTTPClient library to the libraries folder.
It creates the following file system..,


HTTPClient
|________ ( Folder ) default folder ( this contains the needed files )
|________ ( Folder ) alt
|________ ( Folder ) doc
|________ ( Folder ) http
|________ ( Folder ) https
|________ ( Folder ) shttp

When I use a class such as HTTPConnection which is at HTTPClient.HTTPConnection according to the javadoc, Netbeans says "package HTTPClient cannot be found". When I run fix imports, netbeans adds import statements such as import HTTPClient.HTTPConnection, then flags them as errors, saying "package HTTPClient cannot be found".

BlueJ just imports HTTPConnection from the root HTTPClient folder.

If you have the time, could you download HTTPClient and see if you can get it to work within netbeans as a library. The download is tiny and includes some small example source code files.

Thank you for your help so far.

Darren
[ January 31, 2006: Message edited by: D R Wilkinson ]
 
Rajagopal Manohar
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Darren,
I am at my home and don�t have access to NetBeans here. But based on your problem description I can guess what is going wrong

I reference folder HTTPClient for the classpath.


package HTTPClient cannot be found



I believe referencing the folder containing the folder HTTPClient rather than the HTTPClient folder itself should solve your problem, any way it's worth a shot. Let me know if it works.

-Rajagopal
 
reply
    Bookmark Topic Watch Topic
  • New Topic