简体   繁体   中英

Java: The import org.apache.commons.lang cannot be resolved [Eclipse]

I've been handed a java project for modification, so I went ahead and decided to set it up in my MacBook. I loaded the project into Eclipse (Luna), imported and added all the external jars necessary, and pretty much tried to copy the old setup.

Then, I get this:
马尔科

Which is weird, because I could've sworn I added that as a JAR (same one from the old setup): 马球 Oh, wait. There it is.

Now, according to this, which may or may not apply, as it is NetBeans (not sure if there's much of a difference), I should use org.apache.commons.lang3.StringEscapeUtils;

Which, however, gives me this:

在此处输入图片说明

EDIT: Here's the part of the code that uses the StringEscapeUtils: 在此处输入图片说明

Sorry if this seems trivial, but I'm kinda stumped. Can anyone help? Thanks.

EDIT: It would appear that in trying to solve this problem, I ran into a different one. After changing the org.apache.commons.lang.StringEscapeUtils; into org.apache.commons.lang3.StringEscapeUtils; , I noticed the error also says Unable to load realm info from SCDynamic store .

At this point, I'm not sure if I did solve the previous error, or not, as I probably need to fix this new error to proceed.

Fortunately or unfortunately your other libraries require an older version of your commons lang. That is, other libraries (like hadoop) may have a dependency on apache commons 2 library So include the older version commons-lang-2.x version library and it should work fine.

Check this Apache Hadoop dependency link:

http://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-common/dependency-analysis.html

There is a dependency on commons-lang version 2.6. So include that library in your eclipse classpath

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM