Unable to use a package org.apache.commons.lang.StringUtils

I am new to Jdeveloper and I was writing a program which used text in between two strings. I stumbled upon StringUtils.substringBetween() function but when I compile the program it says it cannot find variable StringUtils and does not recognise org.apache.commons.lang.StringUtils package. Please do tell me where I am going wrong. One thing I thought was the package was missing from the libraries but since I am new I don't know how to install such a package or where to install for that matter. I am using jdev 10.1.3.5.0. The code I stumbled upon on the net 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); } } 
3

3 Answers

Download apache-lang common from apache jakarta sie:

After getting jar file please put this jar in your project's build path, if you are not able to find build path then go Jdeveloper help file and type "build path" and you will get all intrustion over there.

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

If its not a web application you have to check how you can add it to your build path with JDeveloper.

Add Apache Maven library. This will resolves the issue (project properties -> libraries and class patch -> add library).

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like