javaapacheintellij-ideaapache-commons-lang3

Intellij cannot resolve symbol 'lang3' apache


I would like to use StringUtils and have downloaded the "apache commons jar" zip file, copied the unzipped jar file into a lib folder in my intellij project, and added it to Libraries and to the classpath (via Project Settings). Then I imported with

import org.apache.commons.lang3.StringUtils;

but intelliJ can't resolve 'lang3'. Does anyone have any advice? Note: similar questions exist on stack exchange, eg. here and here, but they're not quite the same issue and their solutions haven't helped.

FYI I downloaded the 'common-lang3/common-lang3.jar.zip' folder from this website.

Thanks!


Solution

  • You need to unpack the zip and add the extracted common-lang3.jar file to the module dependencies instead of the downloaded common-lang3.jar.zip file.

    Here is the sample project: HelloStringUtils.zip.

    Result of the execution and import working:

    Hello working

    Dependency configuration screenshots: