The import org.apache cannot be resolved – Java Concepts

The import org.apache cannot be resolved

The import org.apache cannot be resolved is very common error. It happens when you don’t have required httpclient library in your projects library path.

Solution

Solution is to configure httpclient library properly. This solution will fix issues related to below mentioned libraries.

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.protocol.HTTP;

Step -1 :

Go to https://hc.apache.org/downloads.cgi and download httpclient version 4.5.x (e.g. 4.5.13).

Extract the tar.gz file to your target folder where you want to store these libraries.

Step -2:

Go to your project build path in Eclipse. Right click on pom.xml -> Build path -> Configure Build Path

Go to Librarires –> Add External Libraries

Select all of the jar files extracted in previous step.

Click “Apply and Close”

It should fix the issue.

If you are preparing for Java Certificate exam, You can take a Practice Test by clicking here. Practice Test have real exam questions. Thus it will ensure that you pass your Certificate Exam without any surprise.

  If you want to crack an interview for the Java Developer role, a demo interview will fortify your chances. Thus, Book an interview preparation session.

#ITCertification #AWS #Google #Azure #ITJobs #ITCareer

Leave a Comment

आपका ईमेल पता प्रकाशित नहीं किया जाएगा.

Shopping Cart