Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/401.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在MAC jEdit上安装apache.commons.lang_Java_Macos_Installation_Jedit_Apache Commons Lang - Fatal编程技术网

Java 在MAC jEdit上安装apache.commons.lang

Java 在MAC jEdit上安装apache.commons.lang,java,macos,installation,jedit,apache-commons-lang,Java,Macos,Installation,Jedit,Apache Commons Lang,我需要帮助在Mac jEdit上安装Apache.Commons.Lang 采取的步骤: 我需要帮助在Mac jEdit上安装Apache.Commons.Lang 我已经从Apache下载了该文件 我试着在许多地方复制“commons-lang3-3.3.2.jar”,但没有成功 我尝试使用以下简单文件测试我的安装: import org.apache.commons.lang3.StringUtils; public class TestOne { public static vo

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

采取的步骤:

  • 我需要帮助在Mac jEdit上安装Apache.Commons.Lang
  • 我已经从Apache下载了该文件
  • 我试着在许多地方复制“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个错误

    感谢您的帮助/指导

    (我的第一篇帖子)

    来自:

    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
    
    你没提到ant所以我想1号已经出局了。我会编辑,以防你使用它

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

    如果手动编译,则需要使用()进行编译 窗户: javac-classpath路径到jar;路径到另一个jar;指向文件夹someFile.java的路径 mac/linux: javac-classpath path_to_jar:path_to_otherjar:path_to_folder someFile.java


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

    在我的头撞了几天后,我安装了Eclipse。
    更干净的设置


    感谢所有帮助过我的人

    您是否已将jar添加到类路径?如何编译代码?您使用ant或JCompiler(JEdit插件)还是在JEdit之外编译?谢谢大家,很抱歉回复太晚。我在MAC上使用终端进行编译。我没有将jar添加到类路径中。我不知道怎么做。你能给我指出正确的方向吗?再次感谢Joeblade,我没有使用Ant,我对编码是新手,所以我不知道如何实现这一点。如果这是你推荐的最简单的方法,我可以开始查找它。你目前正在以某种方式编译它,否则你不会得到错误。因此,我建议您了解目前的编译方式。检查答案中的文档链接。手动编译的最基本方法是转到源文件夹(假设您的java文件存在于com.abc包和位于c:/dev/project/src/com/abc/Test.java的磁盘站点上,然后转到c:/dev/project/src,在那里运行javac-classpath a:b:c com.abc.Test.java,它应该可以编译。使用a:b:c是指向jar文件的路径谢谢Joe,我使用MAC上的终端进行编译,您在存放java的文件中是正确的。)但是,我尝试了你的解决方案,我得到了一个错误:javac:no source files用法:javac use-帮助获取一个可能的选项列表。但是,我可以编译和执行其他不使用common.lang的文件。我正在浏览你列出的文档,我正在根据你的指导制定解决方案……非常感谢!