java.lang does not contain a class called StringUtils. Several third-party libs do, such as Apache Commons Lang or the Spring framework. Make sure you have the relevant jar in your project classpath and import the correct class.
java.lang does not contain a class called StringUtils. Several third-party libs do, such as Apache Commons Lang or the Spring framework. Make sure you have the relevant jar in your project classpath and import the correct class.
StringUtils is an Apache Commons project. You need to download and add the library to your classpath.
To use:
import org.apache.commons.lang3.StringUtils;
Edited 07.12.2018:
I think dependency for StringUtils you are using is not proper.
Please add below dependency to gradle and Sync project and import your class.
implementation 'org.apache.commons:commons-lang3:3.6'
This on is using deprecated task (but should still works):
compile 'org.apache.commons:commons-lang3:3.5'
Edit:
As OoDeLally mentioned in a comment,
Above mentioned version is deprecated, Please use below dependency:
implementation 'org.apache.commons:commons-text:1.9'
Edit 2:
deprecated as for July 2019. Use stackoverflow.com/a/55567755/1541141 instead
Thanks @OoDeLally!
for StringUtils you need to add in app.gradle
implementation 'org.apache.commons:commons-text:1.7'
Check your version of commons-lang, mine was version 2.6 used sudo find / | grep commons-lang
add to the dependencies before plugins and ensure id starts with I not i:
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
Does not build as per wiki there is no controller/opendaylight/distribution/opendaylight/target in order to ./run.sh So I am looking for that now ??
Since OP did not specify details I guess this may be about running maven on Ubuntu 14.
Maven packaging on Ubuntu seems to have some "issue".
After apt-get install maven in Ubuntu 14.04.1 LTS and attempting to package my project with mvn package I got the same exception.
Workaround from comment on github is:
sudo ln -s ../../java/commons-lang.jar /usr/share/maven/lib
That fixed maven at least in my case.
Try running the following commands and examine the output:
$ mvn dependency:tree
$ mvn help:effective-pom
Look for commons-lang, maybe something will draw your attention like excludes or dependency overrides. Also, is:
$ mvn dependency:copy-dependencies
copying commons-lang JAR to your target?
Adding following dependency to pom.xml in dependencies tag helped me:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>