Cannot use package org.apache.commons.lang.StringUtils

I am new to Jdeveloper, and I wrote a program that used text between two lines. I came across the StringUtils.substringBetween() function, but when I compile the program, it says that it cannot find the StringUtils variable and does not recognize the org.apache.commons.lang.StringUtils package. Please tell me where I am going wrong. I thought the package was not in the libraries, but since I'm new, I don’t know how to install such a package or where to install it. I am using jdev 10.1.3.5.0. The code I came across the network is this:

 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); } } 
+6
source share
3 answers

Download apache-lang common from apache jakarta sie:

http://commons.apache.org/lang/

After receiving the jar file, put this jar in your project build path if you cannot find the build path, then go to the Jdeveloper help file and enter "build path" and you will get all the intrusions there.

+5
source

Download commons-lang and drop it into your / WEB -INF / lib folder.

If this is not a web application, you need to check how you can add it to your build path using JDeveloper.

0
source

Add Apache Maven Library. This will solve the problem (project properties β†’ libraries and class patch β†’ add library).

0
source

Source: https://habr.com/ru/post/901875/


All Articles