I'm getting a ClassNotFoundException when I try to execute the following code:
import org.apache.commons.text.WordUtils;
public class CapitalizeFirstLetters {
public static void main(String[] args) {
String str="this is a test";
str=WordUtils.capitalizeFully(str);
System.out.println(str);
}
}
I'm new to importing libraries in Java. Here is what my Package Explorer and Build Path look like (I closely followed advice from other people asking similar questions).
Project Explorer , Java Build Path
and here is the error text:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
at org.apache.commons.text.WordUtils.capitalizeFully(WordUtils.java:494)
at org.apache.commons.text.WordUtils.capitalizeFully(WordUtils.java:464)
at CapitalizeFirstLetters.main(CapitalizeFirstLetters.java:7)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang3.StringUtils
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 3 more
Can anyone please help me with this? I cannot find the answer for this problem in Eclipse anywhere online. So far I have tried: deleting everything and starting over.
Thank you!