Java 无法使用包org.apache.commons.lang.StringUtils

Java 无法使用包org.apache.commons.lang.StringUtils,java,package,jdeveloper,Java,Package,Jdeveloper,我是Jdeveloper的新手,当时正在编写一个程序,在两个字符串之间使用文本。我偶然发现了StringUtils.substringBetween()函数,但当我编译程序时,它说它找不到变量StringUtils,并且无法识别org.apache.commons.lang.StringUtils包。请告诉我哪里出了问题。有一件事我认为是程序包从库中丢失了,但由于我是新手,我不知道如何安装这样的程序包,也不知道在哪里安装。我使用的是JDEV10.1.3.5.0。我在网上偶然发现的代码是: imp

我是Jdeveloper的新手,当时正在编写一个程序,在两个字符串之间使用文本。我偶然发现了
StringUtils.substringBetween()
函数,但当我编译程序时,它说它找不到变量
StringUtils
,并且无法识别
org.apache.commons.lang.StringUtils
包。请告诉我哪里出了问题。有一件事我认为是程序包从库中丢失了,但由于我是新手,我不知道如何安装这样的程序包,也不知道在哪里安装。我使用的是JDEV10.1.3.5.0。我在网上偶然发现的代码是:

import java.util.Date;

import org.apache.commons.lang.StringUtils;

public class NestedString {

    public static void main(String[] args) {

        String helloHtml = "<html>" + "<head>" + " <title>Hello World from Java</title>"
                + "<body>" + "Hello, today is: " + new Date() + "</body>" + "</html>";
        String title = StringUtils.substringBetween(helloHtml, "<title>", "</title>");
        String content = StringUtils.substringBetween(helloHtml, "<body>", "</body>");
        System.out.println("title = " + title);
        System.out.println("content = " + content);
    }
}
import java.util.Date;
导入org.apache.commons.lang.StringUtils;
公共类嵌套字符串{
公共静态void main(字符串[]args){
字符串helloHtml=“”+”+“Hello World from Java”
+你好,今天是:“+新日期()+”+“+”;
String title=StringUtils.substringBetween(helloHtml,“,”);
String content=StringUtils.substringBetween(helloHtml,“,”);
System.out.println(“title=“+title”);
System.out.println(“content=“+content”);
}
}
下载并将其放入/WEB-INF/lib文件夹


如果不是web应用程序,您必须检查如何使用JDeveloper将其添加到构建路径。

从apache jakarta sie下载apache lang common:


获取jar文件后,请将此jar放在项目的构建路径中,如果找不到构建路径,请转到Jdeveloper帮助文件并键入“构建路径”,您将在那里获得所有Intrusion。

添加Apache Maven库。这将解决问题
(项目属性->库和类补丁->添加库)。

我想JDeveloper肯定有办法将库和jar文件添加到项目的构建路径中。您需要查看IDE的帮助文件以了解如何执行此操作。明白了。只需转到项目,然后转到项目属性,并将jar文件添加到库中。感谢您为我指明了正确的方向。很酷,很高兴您现在可以使用它了!