I have downloaded "commons-lang-2.6.jar" and added to my java project but I can't use StringUtils
. Is there another jar file I should download or I have to change something in the project structure?
Asked
Active
Viewed 2.1k times
4
-
R u getting any error? what is the exact issue when you say "But I can't use StringUtils"? – SRy Feb 25 '13 at 22:27
-
The error is "Cannot resolve symbol “StringUtils”" – AliBZ Feb 25 '13 at 22:28
-
What IDE? And did you just setup your jdk? – Jane Doh Feb 25 '13 at 22:28
-
its intellij idea 12 CE, it works on windows with intellij idea 11.1 CE but not in mac. The thing is I import "com.sun.deploy.util.StringUtils" in windows and works, but in mac it doesn't work – AliBZ Feb 25 '13 at 22:30
-
Are you able to import other java classes on your mac? You may need to set the path for your jre? – Jane Doh Feb 25 '13 at 22:33
-
yes, I fixed the problem but still don't know why it works on windows and not on mac. funny thing is in windows, I didn't even import anything and "com.sun.deploy.util.StringUtils" works, but in mac I have to import the apache commons. – AliBZ Feb 25 '13 at 22:34
-
Weird, did Ctrl+Alt+S try to import anything? – Jane Doh Feb 25 '13 at 22:35
-
File menu > Settings > Code Style > Java > Imports – Jane Doh Feb 25 '13 at 22:39
-
I am not able to find any `stringUtils` in http://javasourcecode.org/html/open-source/jdk/jdk-6u23/com/sun/deploy/util/ package. Are you sure "stringUtils" you are mentioning is from this import only. – SRy Feb 25 '13 at 22:41
-
@Srinivas yes, when I comment it out, it gives me an error. – AliBZ Feb 28 '13 at 01:50
1 Answers
3
-
-
I have this code running using import com.sun.deploy.util.StringUtils in another machine but here it doesn't work. – AliBZ Feb 25 '13 at 22:28
-
2As of latest versions of Apache Commons Lang, the [correct package](http://commons.apache.org/proper/commons-lang/javadocs/api-3.1/org/apache/commons/lang3/StringUtils.html) is `org.apache.commons.lang3`. – Jonik Nov 20 '13 at 00:07