Need help?

I'm available for remote short term contracting or consultancy work. Please check out my LinkedIn profile for more details on my experience.

Please feel free to use the form below to contact me.

Adding external JARs to Android Projects in Netbeans (nbandroid - kenai)

A very annoying issue that I've noticed with the NBAndroid Netbeans plugin, is that it doesn't know how to properly attach an external JAR file to an Android Project.

If you right-click on libraries (under your project folder), and click on 'Add JAR/Folder', it will add a reference to that library/JAR file, which it will recognize in the code (detect all the classes, etc). The problem lies when you try to compile the project - at that point, it doesn't actually add the JAR to the project, which in turn gives you errors when running.

It actually took me quite awhile to find a solution for this, and an annoying one at that.

In order to correct this, you'll have to open up your build.xml file (which is under your project folder, but hidden in the netbeans environment). I had to open up my file explorer (Finder on my mac :-)), and go to the project folder and open it up from there.

Add the following bit under your import file tag:

<target name="-pre-jar">
  <copy todir="${build.classes.dir}">
    <fileset dir="/path/to/your/jar/directory" />

So, if your JAR is in /home/bla/myjars/lala.jar then your path should be "/home/bla/myjars".

Now, try recompiling it and it should work fine.

jon | May 25, 2010 | Comments (4)


cheap ray ban,
softball bats,
christian louboutin shoes,
tory burch sale,
nike mercurial,
timberland boots,
jordan release dates,
tory burch sale,
tommy hilfiger outlet,
ugg australia,
louis vuitton handbags,
calvin kleins outlet,
christian louboutin outlet,
air jordan 2015,
oakley sunglasses cheap,
oakley vault,
oakley sunglasses outlet,
swarovski crystal,
knockoff handbags,
shoes outlet,
cheap basketball shoes,
chanel handbags,
true religion jeans,
abercrombie kids,
hermes belt,
gucci outlet,
chanel bags,
ray ban sunglasses,
rolex watches,
glasses frames,
glasses online,
michael kors handbags clearance,
ray bans,
flat iron,
converse outlet,
ferragamo outlet,
gucci belts,
hollister clothing store,
north face jackets,
the north face jackets,
burbery outlet store,
polo ralph lauren outlet,
polo ralph lauren outlet online,
ralph lauren outlet,
insanity calendar,
jimmy choo outlet,
cheap jordans,
juicy couture,
juicy couture outlet,
kate spade outlet online,
louis vuitton outlet online,
michael kors purses,
michael kors handbags clearance,
michael kors outlet online sale,
michael kors,
michael kors outlet online sale,
north face outlet,
oakley outlet,
pandora charms,
prada outlet,
prada shoes for men,
ray ban sunglasses outlet,
omega watches,
swarovski outlet,
the north face outlet,
tiffany and co outlet,
tiffany's jewelry,
cheap true religion,
true religion jeans women,
ugg boots clearance,
uggs on sale,
ugg boots,
ugg outlet,
oakley sunglasses,
cheap oakley sunglasses,
ralph lauren outlet online,
ralph lauren outlet,
burberry outlet,
toms outlet,
toms shoes,
christian louboutin shoes,
tory burch sale,
gucci handbags,
longchamp handbags,
abercrombie and fitch,
hollister clothing store,
hermes belt,
baseball jerseys,
dre beats,
beats by dre,
ray ban,
michael kors,
michael kors handbags,
marc jacobs handbags,
louis vuitton bags,
ralph lauren uk,
free running,
replica watches,
wedding dress,
pandora uk,
thomas sabo uk,
swarovski uk,
air huarache,
roshe run,
the north face,
louis vuitton,
air jordans,
retro jordans,
air jordan shoes,
nike factory outlet,
nike store,
nike outlet,
nike air max 2014,
air max 2015,
nike air max,
free run,
nike free 5.0,
supra footwear,
new balance shoes,
mont blanc,
mcm handbags,
bottega veneta,
soccer shoes,
celine bags,
roshe runs,
nike roshe run,
vans outlet,
timberland shoes,
ipad cases,
softball bats,
louis vuitton outlet,
burberry outlet,
louboutin shoes,
christian louboutin outlet,
louis vuitton,
prada handbags,
michael kors clearance,
michael kors outlet online sale,
tommy hilfiger kids,
mcm world wide,
moncler outlet,
kate spade outlet,
barbour womens,
ferragamo shoes,
canada goose sale,
louis vuitton,
burberry outlet online,
juicy couture clothes ,
north face,
barbour jacket sale,
beats by dre outlet,
louis vuitton sale,
gucci shoes outlet,
longchamp outlet,
moncler outlet online,
ralph lauren polos,
michael kors handbags,
monster beats,
coach outlet online,,
coach store outlet online,
michael kors outlet,
coach factory outlet,
oakley outlet,
nike jordan shoes,
woolrich outlet,
coach outlet online,
coach outlet online usa,
gucci shoes uk,
coach black friday,
michael kors outlet online,
gucci bags,
the north face outlet online,
ugg boots,
ray ban outlet,
toms outlet,
Comment by www - May 18, 2015 @ 10:05 pm
Worked like a charm. Thanks!
Comment by mcv - June 27, 2014 @ 1:30 pm
That's way the bsteest answer so far!
Comment by Candie - May 06, 2011 @ 10:02 pm
Thank you very much for discovering this bug for me. I spent half day without any clue at why my program's not working. Have you contacted the authors of the nbandroid plugin and reported the bug?
Comment by Severin - January 25, 2011 @ 12:02 pm

Name (required)
Email (will not be published) (required)