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.

Answer from Jonik on Stack Overflow
🌐
Baeldung
baeldung.com › home › java › java string › string processing with apache commons lang 3
String Processing with Apache Commons Lang 3 | Baeldung
January 8, 2024 - <dependency> <groupId>org.apac... find the latest version of this library here. The StringUtils class provides methods for null-safe operations on strings....
🌐
Maven Repository
mvnrepository.com › artifact › org.apache.commons › commons-lang3
Maven Repository: org.apache.commons » commons-lang3
November 12, 2025 - Dependency Injection · XML Processing · Concurrency Libraries · Web Frameworks · Android Platform · Code Generators · View All · Home » org.apache.commons » commons-lang3 · Apache Commons Lang, a package of Java utility classes for the classes that are in java.lang's hierarchy, or are considered to be so standard as to justify existence in java.lang.
🌐
Medium
medium.com › @nagarjun_nagesh › java-apache-commons-stringutils-33c6d779dabe
[Java] Apache Commons StringUtils | by Nagarjun (Arjun) Nagesh | Medium
July 10, 2024 - Java, a language known for its robustness and extensive library support, is further enhanced by third-party libraries that simplify common tasks. One such library is Apache Commons Lang, specifically the StringUtils class, which provides a plethora of utilities for string manipulation.
🌐
GeeksforGeeks
geeksforgeeks.org › java › string-handling-with-apache-commons-stringutils-class-in-java
String Handling with Apache Commons' StringUtils Class in Java - GeeksforGeeks
April 28, 2025 - Run a Maven build to download the dependency and add it to your project's classpath. Import the StringUtils class in your Java code.
🌐
Apache Commons
commons.apache.org › lang › dependency-info.html
Maven Coordinates – Apache Commons Lang
Copyright © 2001-2025 The Apache Software Foundation. All Rights Reserved
Find elsewhere
🌐
GitHub
github.com › OpenZeppelin › openzeppelin-foundry-upgrades › issues › 89
`solidity-stringutils` dependency can cause problems with compilation · Issue #89 · OpenZeppelin/openzeppelin-foundry-upgrades
October 17, 2024 - However, solidity-stringutils prevents this because it uses assembly instead of assembly ("memory-safe"). I think openzeppelin-foundry-upgrades should switch from the deprecated solidity-stringutils dependency to vm.split and other funcs: https://github.com/foundry-rs/forge-std/blob/726a6ee5fc8427a0013d6f624e486c9130c0e336/src/Vm.sol#L1132.
Author   StackOverflowExcept1on
🌐
Baeldung
baeldung.com › home › java › java string › an introduction to apache commons lang 3
An Introduction to Apache Commons Lang 3 | Baeldung
January 8, 2024 - <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.14.0</version> </dependency> The first utility class that we’ll cover in this introductory roundup is StringUtils.
🌐
Apache Maven
maven.apache.org › plugins › maven-dependency-plugin › xref › org › apache › maven › plugins › dependency › utils › StringUtils.html
StringUtils xref
18 */ 19 package org.apache.maven.plugins.dependency.utils; 20 21 import static java.util.Objects.isNull; 22 23 public final class StringUtils { 24 private StringUtils() {} 25 26 public static boolean isEmpty(String s) { 27 return isNull(s) || s.isEmpty(); 28 } 29 30 public static boolean isNotEmpty(String s) { 31 return !isEmpty(s); 32 } 33 }
🌐
Stack Abuse
stackabuse.com › guide-to-apache-commons-stringutils-class-in-java
Guide to Apache Commons' StringUtils Class in Java
September 27, 2023 - With the commons-lang3 dependency in our project, we can move on to discussing some of the most used methods from StringUtils.
🌐
JavaBeat
javabeat.net › home › how to use stringutils class in java
How to Use StringUtils Class in Java
March 8, 2024 - To Use the StringUtils class in Java, first, add its corresponding Apache Commons dependency in a “pom.xml” file of your maven project. After this, you can import the StringUtils class in your Java application and use any of its methods ...
🌐
Medium
medium.com › @nirbhaysingh281 › fatal-error-compiling-java-lang-noclassdeffounderror-org-apache-commons-lang3-stringutils-4484fa184854
Fatal error compiling: java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils: | by Nirbhay Singh | Medium
September 18, 2024 - The error you’re encountering suggests that the Maven build is failing because the class org.apache.commons.lang3.StringUtils cannot be found during compilation. This indicates that the Apache Commons Lang library, which provides the StringUtils class, is either missing or incorrectly referenced in your project's dependencies.
🌐
GitHub
github.com › w3c › css-validator › issues › 106
Missing StringUtils dependency · Issue #106 · w3c/css-validator
October 13, 2017 - Hi, I noticed the following issue with your current master: When building a jar file using ant: ant jar, the created css-validator.jar is missing a dependency resulting in a crash: roiex@Robins-PC:/mnt/e/GitHub/css-validator$ java -jar css-validator.jar http://localhost:4000 {output=text, profile=css3, vextwarning=false, warning=2, medium=all, lang=en} Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils at org.apache.velocity.runtime.resource.ResourceManagerImpl.initialize(ResourceManagerImpl.java:161) at org.apache.velocity.runtime.RuntimeInstance.in
Author   RoiEXLab
🌐
Educative
educative.io › answers › what-is-stringutilsisempty-in-java
What is StringUtils.isEmpty in Java?
<dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.12.0</version> </dependency> For other versions of the commons-lang package, refer to the Maven Repository. You can import the StringUtils class as follows.
Top answer
1 of 6
44

I have added commons-lang-2.6.jar & commons-lang3-3.1-sources.jar...

Here's your problem: commons-lang-2.6.jar doesn't contain the org.apache.commons.lang3 package, since that's part of version 3, and commons-lang3-3.1-sources.jar contains the source code, not the byte code.

You need to include commons-lang3-3.1.jar instead.

2 of 6
19

If you're using Maven, put this inside your pom.xml file:

Maven Central Repository for Commons Lang:

<dependency>
    <groupId>commons-lang</groupId>
    <artifactId>commons-lang</artifactId>
    <version>2.6</version>
</dependency>

Maven Central Repository for Apache Commons Lang:

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-lang3</artifactId>
    <version>3.17</version>
</dependency>

Don't forget to Update Maven Project

mvn clean install -U


If you're using Gradle, put this inside your build.gradle file:

implementation group: 'commons-lang', name: 'commons-lang', version: '2.6'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.17.0'

Gradle (Short)

implementation 'commons-lang:commons-lang:2.6'
implementation 'org.apache.commons:commons-lang3:3.17.0'

Gradle (Kotlin)

implementation("commons-lang:commons-lang:2.6")
implementation("org.apache.commons:commons-lang3:3.17.0")

Don't forget to Update Gradle Project

gradle --refresh-dependencies clean build


Apache Commons Lang Dependency Information

Last Published: 29 August 2024 | Version: 3.17

Apache Maven

<dependency>
  <groupId>org.apache.commons</groupId>
  <artifactId>commons-lang3</artifactId>
  <version>3.17.0</version>
</dependency>

Apache Ivy

<dependency org="org.apache.commons" name="commons-lang3" rev="3.17.0">
  <artifact name="commons-lang3" type="jar" />
</dependency>

Groovy Grape

@Grapes(
@Grab(group='org.apache.commons', module='commons-lang3', version='3.17.0')
)

Gradle/Grails

implementation 'org.apache.commons:commons-lang3:3.17.0'

Scala SBT

libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.17.0"

Leiningen

[org.apache.commons/commons-lang3 "3.17.0"]

Reference:

  • https://commons.apache.org/proper/commons-lang/index.html
  • https://commons.apache.org/proper/commons-lang/dependency-info.html

Maven Central Repository Artifacts:

  • https://mvnrepository.com/artifact/commons-lang/commons-lang
  • https://mvnrepository.com/artifact/org.apache.commons/commons-lang3