0

我需要帮助在 Mac jEdit 上安装 Apache.Commons.Lang

采取的步骤:

  1. 我需要帮助在 Mac jEdit 上安装 Apache.Commons.Lang。
  2. 我已经从 Apache 下载了文件。
  3. 我尝试在许多位置复制“commons-lang3-3.3.2.jar”但无济于事。

我尝试使用这个简单的文件测试我的安装:

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));
    }

}

我收到以下错误:

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 个错误

感谢您的任何帮助/指导!

(我的第一篇文章)

4

2 回答 2

0

来自jedit 手册

Java 类路径

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

你没有提到蚂蚁,所以我假设 1 出来了。如果您确实使用它,我会进行编辑。

JCompiler 有一个类路径设置(查找 JCompiler 插件的选项)。将 jar 文件添加到那里的类路径中。

如果您手动编译,则需要使用以下命令进行编译:(请参阅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

在 osx/linux 上,您使用 : (冒号) not ; 分隔类路径元素 (分号)

于 2014-11-28T11:57:34.273 回答
0

在把我的头撞到墙上几天之后,我安装了 Eclipse。
更清洁的设置。

感谢所有帮助过的人!

于 2014-11-29T04:07:48.353 回答