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
🌐
Apache Commons
commons.apache.org › proper › commons-lang › apidocs › org › apache › commons › lang3 › StringUtils.html
StringUtils (Apache Commons Lang 3.20.0 API)
org.apache.commons.lang3.StringUtils · public class StringUtils extends Object · Operations on String that are null safe. IsEmpty/IsBlank - checks if a String contains text · Trim/Strip - removes leading and trailing whitespace · Equals/Compare - compares two strings in a null-safe manner ·
🌐
GitHub
github.com › apache › commons-lang › blob › master › src › main › java › org › apache › commons › lang3 › StringUtils.java
commons-lang/src/main/java/org/apache/commons/lang3/StringUtils.java at master · apache/commons-lang
* StringUtils.getLevenshteinDistance("hello", "hallo") = 1 ... * @since 3.0 Changed signature from getLevenshteinDistance(String, String) to getLevenshteinDistance(CharSequence, CharSequence) * @deprecated As of 3.6, use Apache Commons Text
Author   apache
🌐
Apache Commons
commons.apache.org › proper › commons-lang › javadocs › api-3.3 › org › apache › commons › lang3 › StringUtils.html
StringUtils (Apache Commons Lang 3.3 API)
org.apache.commons.lang3.StringUtils · public class StringUtils extends Object · Operations on String that are null safe. IsEmpty/IsBlank - checks if a String contains text · Trim/Strip - removes leading and trailing whitespace · Equals - compares two strings null-safe ·
🌐
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 - In addition to providing a general introduction to the library, this tutorial demonstrates methods of the StringUtils class which is used for manipulation of String instances. In order to use the Commons Lang 3 library, just pull it from the central Maven repository using the following dependency: <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.14.0</version> </dependency> You can find the latest version of this library here.
🌐
Apache Commons
commons.apache.org › proper › commons-lang › javadocs › api-release › org › apache › commons › lang3 › StringUtils.html
StringUtils (Apache Commons Lang 3.11 API)
org.apache.commons.lang3.StringUtils · public class StringUtils extends Object · Operations on String that are null safe. IsEmpty/IsBlank - checks if a String contains text · Trim/Strip - removes leading and trailing whitespace · Equals/Compare - compares two strings in a null-safe manner ·
🌐
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 - import org.apache.commons.lang3.StringUtils; Use the StringUtils class in your Java code, as described in the previous answer.
🌐
Apache Commons
commons.apache.org › proper › commons-lang › javadocs › api-3.3.2 › org › apache › commons › lang3 › StringUtils.html
StringUtils (Apache Commons Lang 3.3.2 API)
org.apache.commons.lang3.StringUtils · public class StringUtils extends Object · Operations on String that are null safe. IsEmpty/IsBlank - checks if a String contains text · Trim/Strip - removes leading and trailing whitespace · Equals - compares two strings null-safe ·
Find elsewhere
🌐
Apache Commons
commons.apache.org › proper › commons-lang › javadocs › api-3.4 › org › apache › commons › lang3 › StringUtils.html
StringUtils (Apache Commons Lang 3.4 API)
org.apache.commons.lang3.StringUtils · public class StringUtils extends Object · Operations on String that are null safe. IsEmpty/IsBlank - checks if a String contains text · Trim/Strip - removes leading and trailing whitespace · Equals - compares two strings null-safe ·
🌐
Apache Commons
commons.apache.org › proper › commons-lang › javadocs › api-3.1 › org › apache › commons › lang3 › StringUtils.html
StringUtils (Commons Lang 3.1 API)
java.lang.Object org.apache.commons.lang3.StringUtils · public class StringUtils · extends Object · Operations on String that are null safe. IsEmpty/IsBlank - checks if a String contains text · Trim/Strip - removes leading and trailing whitespace · Equals - compares two strings null-safe ·
🌐
Reddit
reddit.com › r/java › look how they massacred my boy (apache commons lang)
r/java on Reddit: Look how they massacred my boy (Apache Commons Lang)
August 21, 2025 -

Seriously, what madness drove the commons lang contributors to deprecate StringUtils.equals()?

I'm gonna rant for a bit here. It's been a long day.

I spend all morning in an incident call, finally get time to do some coding in the afternoon.

I make progress on a bug fix, clean up some dead code like a good boy scout, and I’m feeling like I actually accomplished something today.

Oh, this service is getting flagged for CVE-2025-48924? Let me take care of that.

And then, confusion. Anger.

Deprecated method? StringUtils.equals()? That can't be.

Sure as shit, they deprecated it. Let's see what has been replaced with.

Strings.CS.equals()? Is that character sequence? No, it's case sensitive. Fucking hell. I harp on juniors for their silly acronyms. Did not expect to see them in a library like this. Just unnecessary. If Java developers had a problem with verbosity, well, they wouldn't be Java developers.

I'll admit I've been an open-source leech, contributing nothing to the community, but this one has lit a fire in me.

If this issue isn't resolved, are there any volunteers to help with a fork? I feel like common-sense-lang3 would be an appropriate name for an alternative.

https://issues.apache.org/jira/projects/LANG/issues/LANG-1777?filter=allopenissues

🌐
Apache Commons
commons.apache.org › proper › commons-lang › apidocs › org › apache › commons › lang3 › Strings.html
Strings (Apache Commons Lang 3.20.0 API)
org.apache.commons.lang3.Strings · public abstract class Strings extends Object · String operations where you choose case-sensitive CS vs. case-insensitive CI through a singleton instance. Since: 3.18.0 · See Also: CharSequenceUtils · StringUtils · Nested Classes ·
🌐
Apache Commons
commons.apache.org › proper › commons-lang › apidocs › org › apache › commons › lang3 › package-summary.html
org.apache.commons.lang3 (Apache Commons Lang 3.20.0 API)
Lang has a series of String utilities. The first is StringUtils, oodles and oodles of functions which tweak, transform, squeeze and cuddle java.lang.Strings. In addition to StringUtils, there are a series of other String manipulating classes; RandomStringUtils and StringEscapeUtils.
🌐
Eduardo Figueiredo
homepages.dcc.ufmg.br › ~andrehora › examples › org.apache.commons.lang3.StringUtils.join.11.html
org.apache.commons.lang3.StringUtils.join
public class StringUtilsTrial { public static void main(String[] args) { // Join all Strings in the Array into a Single String, separated by $#$ System.out.println("7) Join Strings using separator >>>" + StringUtils.join(new String[] { "AB", "CD", "EF" }, "$#$")); } }
🌐
DZone
dzone.com › data engineering › data › apache commons lang stringutils
Apache Commons Lang StringUtils
May 5, 2012 - StringUtils is part of Apache Commons Lang (http://commons.apache.org/lang/, and as the name suggest it provides some nice utilities for dealing with Strings, going beyond what is offered in java.lang.String.
🌐
Maven Repository
mvnrepository.com › artifact › org.apache.commons › commons-lang3
Maven Repository: org.apache.commons » commons-lang3
November 12, 2025 - 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 › @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 - This indicates that the Apache Commons Lang library, which provides the StringUtils class, is either missing or incorrectly referenced in your project's dependencies. Here are the steps you can take to resolve this issue: Check the pom.xml for the correct dependency: Ensure that the Apache Commons Lang library is included in your pom.xml file. Add the following dependency if it is missing: <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.12.0</version> <!-- Use the latest version available --> </dependency>
🌐
Apache Commons
commons.apache.org › proper › commons-lang › apidocs › org › apache › commons › lang3 › StringEscapeUtils.html
StringEscapeUtils (Apache Commons Lang 3.20.0 API)
org.apache.commons.lang3.StringEscapeUtils · @Deprecated public class StringEscapeUtils extends Object · Deprecated. As of 3.6, use Apache Commons Text StringEscapeUtils instead. Escapes and unescapes Strings for Java, Java Script, HTML and XML. #ThreadSafe# Since: 2.0 ·
🌐
Java Tips
javatips.net › api › org.apache.commons.lang3.stringutils
Java Examples for org.apache.commons.lang3.StringUtils
private static String sanitizeString(String strToClean, Pattern cleanRegexpPattern) { if (strToClean == null) { return null; } String str = strToClean.trim(); str = StringUtils.removeAccents(str); str = StringUtils.lowerCase(str); str = cleanRegexpPattern.matcher(str).replaceAll(DASH); str = CLEAN_DUPLICATE_DASHES_REGEXP_PATTERN.matcher(str).replaceAll(DASH); str = org.apache.commons.lang3.StringUtils.strip(str, DASH); return str; }
🌐
Eduardo Figueiredo
homepages.dcc.ufmg.br › ~andrehora › examples › org.apache.commons.lang3.StringUtils.html
org.apache.commons.lang3.StringUtils
org apache commons lang3 StringUtils isBlank 1 · org apache commons lang3 StringUtils isBlank 2 · org apache commons lang3 StringUtils isBlank 3 · org apache commons lang3 StringUtils isBlank 4 · org apache commons lang3 StringUtils isBlank 5 · org apache commons lang3 StringUtils isBlank ...