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

enter image description here

I added a generic jang jar file to my classpath, but when I compile it, it says:

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

I tried following steps:

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

but I don't work. Is this the correct editor, or is it something else?

+3


source to share


1 answer


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

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



Also, if you look at the current API document , you will see a new naming structure.

All you have to do is update the import statement to match the new package structure so your compiler can resolve it correctly.

+6


source







All Articles