Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How come I can't import org.apache.commons.lang.StringUtils?

Tags:

java

classpath

enter image description here

I added the common lang jar file in the classpath, but when I compile it says:

error: package org.apache.commons.lang does not exist

I tried to follow the steps described below:

http://oopbook.com/java-classpath-2/classpath-in-jcreator/

but I don't it doesn't work. Is it the editor that's not working properly or is it something else?

like image 240
user3435009 Avatar asked Apr 28 '26 10:04

user3435009


1 Answers

Between major versions 2 and 3 apache changed the package naming scheme on their classes from lang to lang3.

Notice on the download site that for version 2.6 you are downloading "commons-lang-2.6" and for version 3.3.2 you are downloading "commons-lang3-3.3.2".

Also, if you check out the current API doc you'll see the new naming structure.

All you need to do is update your import statement to match the new package structure and your compiler will be able resolve it correctly.

like image 59
azurefrog Avatar answered Apr 30 '26 23:04

azurefrog