NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Can't add JAR file to Netbeans

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
oneworld95



Joined: 04 May 2009
Posts: 3

PostPosted: Mon May 04, 2009 2:35 pm    Post subject: Can't add JAR file to Netbeans Reply with quote

I'm trying to add an Apache Commons JAR file to my project. Here's what I've done:
1) Added the JAR file to the project by right-clicking the Libraries folder in Netbeans.
2) Also dropped the file into the web\WEB-INF\lib folder.

Regardless of what I try, when I type this into the .java file,

Code:
import org.apache.commons.lang;


Netbeans highlights it with error "package org.apache.commons does not exist." Help!!
Back to top
tusharvjoshi



Joined: 15 Aug 2008
Posts: 298
Location: Nagpur

PostPosted: Tue May 05, 2009 5:26 am    Post subject: Can't add JAR file to Netbeans Reply with quote

Please tell us more information like

1. The of the JAR file you are using for commons, and the link if possible from where you downloaded that jar
2. Version of NetBeans IDE you are using
3. If possible attach the nbproject folder zipped with the mail


with regards
Tushar

==============================================
Tushar Joshi, Nagpur
MCSD_NET C#, SCJP, RHCE
Software Engineer and Senior Project Manager @ Infospectrum India Private Limited, VOC Captain for NetBeans, JUGNagpur Leader
http://www.info-spectrum.com
http://www.tusharvjoshi.com
http://wiki.netbeans.org/VoiceOfCommunity
http://www.jugnagpur.com


On Mon, May 4, 2009 at 8:05 PM, oneworld95 <address-removed ([email]address-removed[/email])> wrote:
Quote:
I'm trying to add an Apache Commons JAR file to my project. Here's what I've done:

 1) Added the JAR file to the project by right-clicking the Libraries folder in Netbeans.

 2) Also dropped the file into the web\WEB-INF\lib folder.



Regardless of what I try, when I type this into the .java file,




Code:
import org.apache.commons.lang;





Netbeans highlights it with error "package org.apache.commons does not exist." Help!!




Back to top
oneworld95



Joined: 04 May 2009
Posts: 3

PostPosted: Tue May 05, 2009 1:56 pm    Post subject: Re: Can't add JAR file to Netbeans Reply with quote

Hi, thanks for your reply. Please see below for answers to your questions.

1. The JAR file is from here: http://commons.apache.org/downloads/download_lang.cgi
2. 6.5.1
3. I've attached the zip of the project folder.

tusharvjoshi wrote:
Please tell us more information like

1. The of the JAR file you are using for commons, and the link if possible from where you downloaded that jar
2. Version of NetBeans IDE you are using
3. If possible attach the nbproject folder zipped with the mail


with regards
Tushar

==============================================
Tushar Joshi, Nagpur
MCSD_NET C#, SCJP, RHCE
Software Engineer and Senior Project Manager @ Infospectrum India Private Limited, VOC Captain for NetBeans, JUGNagpur Leader
http://www.info-spectrum.com
http://www.tusharvjoshi.com
http://wiki.netbeans.org/VoiceOfCommunity
http://www.jugnagpur.com


On Mon, May 4, 2009 at 8:05 PM, oneworld95 <address-removed ([email]address-removed[/email])> wrote:
Quote:
I'm trying to add an Apache Commons JAR file to my project. Here's what I've done:

 1) Added the JAR file to the project by right-clicking the Libraries folder in Netbeans.

 2) Also dropped the file into the web\WEB-INF\lib folder.



Regardless of what I try, when I type this into the .java file,




Code:
import org.apache.commons.lang;





Netbeans highlights it with error "package org.apache.commons does not exist." Help!!







nbproject.zip
 Description:
Here's the project folder.

Download
 Filename:  nbproject.zip
 Filesize:  10.9 KB
 Downloaded:  351 Time(s)

Back to top
Franz
Posted via mailing list.





PostPosted: Wed May 06, 2009 7:06 am    Post subject: Can't add JAR file to Netbeans Reply with quote

oneworld95 wrote:
Quote:
I'm trying to add an Apache Commons JAR file to my project. Here's what I've done:

1) Added the JAR file to the project by right-clicking the Libraries folder in Netbeans.

2) Also dropped the file into the web\WEB-INF\lib folder.

Have you also added the Jar to the CLASSPATH?
right click your project > properties > Libraries > "Add Jar/Folder"?
Back to top
mwildam



Joined: 16 Sep 2008
Posts: 45

PostPosted: Wed May 06, 2009 9:41 am    Post subject: Reply with quote

I would do the following:
  1. Unzip to a folder of your desire (I use a common folder for external components and create a subfolder for each component there).
    In NetBeans go to tools -> Libraries.
  2. Create a new class library there.
  3. Add the jars to the classpath tab in the library.
  4. In Javadoc tab add the apidocs subfolder (to have javadoc available).
  5. Then go to project properties (Project's context menu -> Properties).
  6. In the categorie libraries add your library on the compile tab.
Back to top
mwildam



Joined: 16 Sep 2008
Posts: 45

PostPosted: Wed May 06, 2009 9:42 am    Post subject: Reply with quote

The result should also be that those jars are copied to your dist folder when you build the project.
Back to top
tusharvjoshi



Joined: 15 Aug 2008
Posts: 298
Location: Nagpur

PostPosted: Wed May 06, 2009 10:04 am    Post subject: Can't add JAR file to Netbeans Reply with quote

Hi,

I tried to do the same things what you have done and found the error in the import statement


instead of :
import org.apache.commons.lang;


use the import statement like:
import org.apache.commons.lang.*;


This will remove the error
with regards
Tushar

==============================================
Tushar Joshi, Nagpur
MCSD_NET C#, SCJP, RHCE
Software Engineer and Senior Project Manager @ Infospectrum India Private Limited, VOC Captain for NetBeans, JUGNagpur Leader
http://www.info-spectrum.com
http://www.tusharvjoshi.com
http://wiki.netbeans.org/VoiceOfCommunity
http://www.jugnagpur.com


On Wed, May 6, 2009 at 12:33 PM, Franz <address-removed ([email]address-removed[/email])> wrote:
Quote:
oneworld95 wrote:
Quote:
I'm trying to add an Apache Commons JAR file to my project. Here's what I've done:

 1) Added the JAR file to the project by right-clicking the Libraries folder in Netbeans.

 2) Also dropped the file into the web\WEB-INF\lib folder.


Have you also added the Jar to the CLASSPATH?
right click your project > properties > Libraries > "Add Jar/Folder"?

Back to top
oneworld95



Joined: 04 May 2009
Posts: 3

PostPosted: Wed May 06, 2009 1:32 pm    Post subject: Re: Can't add JAR file to Netbeans Reply with quote

Thanks, everyone. The last issue was the lang.* Very Happy

tusharvjoshi wrote:
Hi,

I tried to do the same things what you have done and found the error in the import statement


instead of :
import org.apache.commons.lang;


use the import statement like:
import org.apache.commons.lang.*;


This will remove the error
with regards
Tushar

==============================================
Tushar Joshi, Nagpur
MCSD_NET C#, SCJP, RHCE
Software Engineer and Senior Project Manager @ Infospectrum India Private Limited, VOC Captain for NetBeans, JUGNagpur Leader
http://www.info-spectrum.com
http://www.tusharvjoshi.com
http://wiki.netbeans.org/VoiceOfCommunity
http://www.jugnagpur.com


On Wed, May 6, 2009 at 12:33 PM, Franz <address-removed ([email]address-removed[/email])> wrote:
Quote:
oneworld95 wrote:
Quote:
I'm trying to add an Apache Commons JAR file to my project. Here's what I've done:

 1) Added the JAR file to the project by right-clicking the Libraries folder in Netbeans.

 2) Also dropped the file into the web\WEB-INF\lib folder.


Have you also added the Jar to the CLASSPATH?
right click your project > properties > Libraries > "Add Jar/Folder"?

Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


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