软件包org.apache.commons.lang不存在[Netbeans] [英] package org.apache.commons.lang does not exist [Netbeans]
问题描述
是使用基础知识进行编程的新手,我已将其比作Java.
我想编写一个无需循环即可计算n次幂的数字的代码.大约4天前,我一直在尝试使用"commons lang"中的重复方法.我在此站点和其他站点中找到了很多信息,这些信息有助于我了解如何使用此打包产品.
到目前为止,我下载了commons-lang3-3.1,然后将该文件夹保留在与我的项目相同的文件夹中,并通过以下方式将jar文件添加到我的项目的库中:-
Am new to programming with basic knowledge and I've taken a liken to Java.
I wanted to write a code that calculates a number to the nth power without using loops. I've been trying to use the repeat method from "commons lang" which i came to know about, about 4 days ago. I Found a lot of info in this site and others that helped me in understanding how to use this packed.
So far I downloaded commons-lang3-3.1 then kept the folder in the same folder as my project and added the jar file to my project's library by:-
右键单击库
1然后添加JAR/文件夹
2然后我打开commons-lang3-3.1文件夹
3,然后从4个选择中选择"commons-lang3-3.1.jar":
right clicking on libraries
1 then Add JAR/Folder
2 then i opened the commons-lang3-3.1 folder
3 and selected "commons-lang3-3.1.jar" from a number of 4 selections:
- commons-lang3-3.1.jar
- commons-lang3-3.1-javadoc.jar
- commons-lang3-3.1-sources.jar
- commons-lang3-3.1-tests.jar
- commons-lang3-3.1.jar
- commons-lang3-3.1-javadoc.jar
- commons-lang3-3.1-sources.jar
- commons-lang3-3.1-tests.jar
这是用于测试我是否从其他问题之一获得的代码:-
here is a code that am using to test that i got from one of the the other questions:-
0. package refreshingmemory; 1. import org.apache.commons.lang.StringUtils; 2. public class RefreshingMemory { 3. 4. public static void main(String[] args) { 5. String str = "abc"; 6. String repeated = StringUtils.repeat(str, 3); 7. repeated.equals("abcabcabc"); 8. 9. } 10. }
第1行说软件包org.apache.commons.lang不存在.
第7行说应该检查方法的返回值
如果我删除第1行,则会在第6行出现找不到符号
如何成功导入?line 1 says package org.apache.commons.lang does not exist.
line 7 says Should check the method return value
and if i remove line 1 i get a cannot find symbol at line 6
How do I get a successfully import ?Netbeans的屏幕截图:
Screenshot of Netbeans:
推荐答案
http://commons.apache.org/normal/commons-lang/指出以下内容:
请注意,Lang 3.0(及后续版本)使用的软件包( org.apache.commons.lang3 )与以前的版本(org.apache.commons.lang)不同.与早期版本同时使用.
Note that Lang 3.0 (and subsequent versions) use a different package (org.apache.commons.lang3) than the previous versions (org.apache.commons.lang), allowing it to be used at the same time as an earlier version.
因此,请相应地更改包装,或者听从理查德·廷格(Richard Tingle)的建议,然后在装订线中单击错误+灯泡图标(显示行号),然后选择为...添加导入".
So change the package accordingly, or heed Richard Tingle's advice and left click the error+light bulb icon in the gutter (were line numbers are shown) and choose "Add import for...".
import org.apache.commons.lang3.StringUtils;
这篇关于软件包org.apache.commons.lang不存在[Netbeans]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!