installing apache.commons.lang on MAC jEdit

1.3k views Asked by At

I need help installing Apache.Commons.Lang on Mac jEdit

Steps Taken:

  1. I need help installing Apache.Commons.Lang on Mac jEdit.
  2. I have downloaded the file from Apache.
  3. I tried copying the "commons-lang3-3.3.2.jar" in many locations with no avail.

I tried testing my installation with this simple file:

import org.apache.commons.lang3.StringUtils;

public class TestOne {
    public static void main(String[] args) {
            String text = "Hello World";
            System.out.println(StringUtils.reverse(text));
    }

}

I receive the following error:

TestOne.java:1: error: package org.apache.commons.lang3 does not exist
import org.apache.commons.lang3.StringUtils;

                               ^

 TestOne.java:6: error: cannot find symbol
                System.out.println(StringUtils.reverse(text));
                                   ^



 symbol:   variable StringUtils
  location: class TestOne

2 errors

Thanks for any help/guidance!

(My First Post)

2

There are 2 answers

3
Joeblade On

from the jedit manual:

The Java CLASSPATH

1. can define CLASSPATH within the Ant build file if it is being used
2. JCompiler has its own CLASSPATH settings (and SOURCEPATH) which are defined in the plugin's options panel
3. No clean way to have different CLASSPATHs for different projects; there is an incomplete migration to a mechanism for doing this. Ant is the easiest method right now

You didn't mention ant so I'm assuming 1 is out. I'll edit in case you do use it.

JCompiler has a classpath setting (look for JCompiler plugin's option). Add the jar file to the classpath there.

If you compile manually, you need to compile using: (see this for documentation) windows: javac -classpath path_to_jar;path_to_otherjar;path_to_folder someFile.java mac/linux: javac -classpath path_to_jar:path_to_otherjar:path_to_folder someFile.java

On osx/linux you separate the classpath elements with : (colon) not ; (semicolon)

0
newtrail On

After beating my head against the wall for days, I installed Eclipse.
Much cleaner setup.

Thanks to everyone who helped!