| View previous topic :: View next topic |
| Author |
Message |
oneworld95
Joined: 04 May 2009 Posts: 3
|
Posted: Mon May 04, 2009 2:35 pm Post subject: Can't add JAR file to Netbeans |
|
|
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: 272 Location: Nagpur
|
Posted: Tue May 05, 2009 5:26 am Post subject: Can't add JAR file to Netbeans |
|
|
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
|
Posted: Tue May 05, 2009 1:56 pm Post subject: Re: Can't add JAR file to Netbeans |
|
|
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!!
|
|
| Description: |
| Here's the project folder. |
|
 Download |
| Filename: |
nbproject.zip |
| Filesize: |
10.9 KB |
| Downloaded: |
246 Time(s) |
|
|
| Back to top |
|
 |
Franz Posted via mailing list.
|
Posted: Wed May 06, 2009 7:06 am Post subject: Can't add JAR file to Netbeans |
|
|
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
|
Posted: Wed May 06, 2009 9:41 am Post subject: |
|
|
I would do the following:
- 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.
- Create a new class library there.
- Add the jars to the classpath tab in the library.
- In Javadoc tab add the apidocs subfolder (to have javadoc available).
- Then go to project properties (Project's context menu -> Properties).
- In the categorie libraries add your library on the compile tab.
|
|
| Back to top |
|
 |
mwildam
Joined: 16 Sep 2008 Posts: 45
|
Posted: Wed May 06, 2009 9:42 am Post subject: |
|
|
| 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: 272 Location: Nagpur
|
Posted: Wed May 06, 2009 10:04 am Post subject: Can't add JAR file to Netbeans |
|
|
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
|
Posted: Wed May 06, 2009 1:32 pm Post subject: Re: Can't add JAR file to Netbeans |
|
|
Thanks, everyone. The last issue was the lang.*
| 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 |
|
 |
|