0

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)

Jens
  • 67,715
  • 15
  • 98
  • 113
newtrail
  • 1
  • 2

2 Answers2

0

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)

Joeblade
  • 1,735
  • 14
  • 22
  • Hey Joeblade, I'm not using Ant, i'm new to coding so I do not know how to accomplish this. I can start looking it up if its the easiest method you recommend. – newtrail Nov 28 '14 at 13:50
  • Well you currently are compiling it somehow, or you wouldn't get the error. So I would recommend finding out how you compile at present. Check the documentation links in the answer as well. The most basic way to compile manually is to go to your source folder (say your java file lives in package com.abc and on disk sites at c:/dev/project/src/com/abc/Test.java then go to c:/dev/project/src and there run javac -classpath a:b:c com.abc.Test.java it should compile. With a:b:c be the paths to your jar files – Joeblade Nov 28 '14 at 15:20
  • Thanks Joe, I compile using terminal on MAC and you are correct its in the file that houses my java files. However, I tried your solution and I am getting the error: javac: no source files Usage: javac use -help for a list of possible options However, I can compile and execute other files that are not using common.lang I'm going over the documentation you listed and i'm working on the solution based on your guidance... Many Thanks! – newtrail Nov 28 '14 at 15:51
0

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

Thanks to everyone who helped!

newtrail
  • 1
  • 2