4

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!

KMunro
  • 348
  • 4
  • 14

1 Answers1

-1

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:

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • Hi, yes I did, but thanks and I've updated my question – KMunro Nov 21 '18 at 06:54
  • @KMunro see the updated answer. Everything works fine. – CrazyCoder Nov 21 '18 at 07:27
  • @KMunro If it still doesn't work for you, the only way to get help would be to share the [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). – CrazyCoder Nov 21 '18 at 09:37
  • thanks! I noticed your jar had a different name and contents, so I copied that and it worked. Oddly, when I revisit the link in my post, from which I downloaded the original (clearly wrong) jar file, it is the correct file now. I've no idea why but thankyou. – KMunro Nov 21 '18 at 11:51