Issue
Ok. So I'm using maven (which honestly just giving me a headache because of reasons like this).
Put this in my pom file:
maven started doing something... you know, Percentage increasing, progress bar etc lower right corner of Eclipse.
Tried to paste in code from this site so I can try out the library: https://github.com/apache/httpcomponents-client/blob/5.0.x/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientMultipartFormPost.java
But I get
Cannot be resolved to a type
It ended up here in build path window.
I tried run maven clean. Did not help. I am using Maven project. There is even a small little "M" on my project folder :)
I also found where the jars where and added them manually to webapp/WEB-INF/lib folder. That's why you see them in Classpath in picture above. I'm Using Tomcat. I believe this worked before with gson etc.
It is not often that I need to mess with Maven, so I forget in between, and then each time I spend hours, when in fact I believe it should be a simple thing to add a jar.
Surely I must be missing some common practice of how to simply add a dependency using maven in Eclipse.
I have been struggling for 2,5 hours now.
Solution
You also need the httpclient
artifact, as that's the resulting jar file for the repository you pulled code out of. See https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient .
Answered By - nitind