Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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);
    }
}
like image 247
user1004779 Avatar asked Nov 19 '11 06:11

user1004779


1 Answers

Download apache-lang common from apache jakarta sie:

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

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.

like image 173
Abhishek Avatar answered Sep 27 '22 20:09

Abhishek