Solved

How to add org.apache.http jars to project in Eclipse for Android

Posted on 2013-12-07
4
563 Views
Last Modified: 2013-12-24
This seems fairly obvious, but I feel like I may be missing something.  I downloaded 2 necessary jars to use for my project (org.apache.httpclient and org.apache.http),  I added these jars to the classpath by going to projet configure build path and going to 'Add External Jar'  This takes care of all compile errors, but at runtime I'm getting a class not found exception on these classes.  I am not sure if I am missing something or if these are simply bad jars.  I don't have a lot of experience doing this.  Could anyone offer some guidance?
0
Comment
Question by:kpbarem
4 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 39704152
Well it would seem that the runtime classpath is not picking them up. Not doing Android, i can't tell you how the config should go, but that will be the reason for the error
0
 
LVL 35

Accepted Solution

by:
mccarl earned 500 total points
ID: 39707727
Ok, firstly, I don't have a lot of experience in Android, but since you haven't received any other Android specific help, I will give you some ideas to try...

If you don't already have a "libs" folder in your Android project, create a folder called "libs" directly in your project folder. Move the downloaded jar files into this directory. Go into the "Configure Build Path" screen that you mention above, and remove the current references that you have to those jars an then instead of "Add External JARs" just use the "Add JARs" button and navigate to those jar files inside your project/libs folder. While you are in that screen, go to the "Order and Export" tab and select the checkbox next to the jar files that you have added.

Now try to build your project, and see how you go. If you still have issues, can you please post the full ClassNotFoundException message that you are given, it may contain further clues.
0
 

Author Closing Comment

by:kpbarem
ID: 39738519
This gave me a starting point to play with it a little bit.  I'm not entirely sure how, but I got it to work.  Thank you!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now