Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The runtime error "java.lang.NoClassDefFoundError: org/apache/hc/client5/http/classic/HttpClient" is usually caused when the required class or dependency is missing from the classpath. In this case, it seems like the HttpClient class from the Apache HttpComponents library is missing.

To fix this error, you can try adding the necessary dependency to your project's pom.xml file or gradle.build file. For example, if you're using Maven, you can add the following dependency to your pom.xml file:

<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient5</artifactId>
    <version>5.0</version>
</dependency>

If you're using Gradle, you can add the following dependency to your build.gradle file:

implementation 'org.apache.httpcomponents:httpclient5:5.0'

Once you've added the required dependency, rebuild your project and try running it again. This should resolve the NoClassDefFoundError and allow your application to run without issues.