<legend id='vhoF5'><style id='vhoF5'><dir id='vhoF5'><q id='vhoF5'></q></dir></style></legend>

    <small id='vhoF5'></small><noframes id='vhoF5'>

  • <tfoot id='vhoF5'></tfoot>

          <bdo id='vhoF5'></bdo><ul id='vhoF5'></ul>

      1. <i id='vhoF5'><tr id='vhoF5'><dt id='vhoF5'><q id='vhoF5'><span id='vhoF5'><b id='vhoF5'><form id='vhoF5'><ins id='vhoF5'></ins><ul id='vhoF5'></ul><sub id='vhoF5'></sub></form><legend id='vhoF5'></legend><bdo id='vhoF5'><pre id='vhoF5'><center id='vhoF5'></center></pre></bdo></b><th id='vhoF5'></th></span></q></dt></tr></i><div id='vhoF5'><tfoot id='vhoF5'></tfoot><dl id='vhoF5'><fieldset id='vhoF5'></fieldset></dl></div>

        Mac 用户 - 如何在 Mac 中设置 CLASSPATHS(我正在做一个 Lucene 演示)

        Mac User - How do I set CLASSPATHS in Mac (I#39;m working on a Lucene Demo)(Mac 用户 - 如何在 Mac 中设置 CLASSPATHS(我正在做一个 Lucene 演示))
        <tfoot id='fJaHk'></tfoot>

          • <bdo id='fJaHk'></bdo><ul id='fJaHk'></ul>

              <i id='fJaHk'><tr id='fJaHk'><dt id='fJaHk'><q id='fJaHk'><span id='fJaHk'><b id='fJaHk'><form id='fJaHk'><ins id='fJaHk'></ins><ul id='fJaHk'></ul><sub id='fJaHk'></sub></form><legend id='fJaHk'></legend><bdo id='fJaHk'><pre id='fJaHk'><center id='fJaHk'></center></pre></bdo></b><th id='fJaHk'></th></span></q></dt></tr></i><div id='fJaHk'><tfoot id='fJaHk'></tfoot><dl id='fJaHk'><fieldset id='fJaHk'></fieldset></dl></div>

              <legend id='fJaHk'><style id='fJaHk'><dir id='fJaHk'><q id='fJaHk'></q></dir></style></legend>

              <small id='fJaHk'></small><noframes id='fJaHk'>

                <tbody id='fJaHk'></tbody>

                • 本文介绍了Mac 用户 - 如何在 Mac 中设置 CLASSPATHS(我正在做一个 Lucene 演示)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试让我的 Apache Lucene 演示工作,我打算在本教程中设置类路径 http://lucene.apache.org/java/2_3_2/demo.html

                  I'm trying to get my Apache Lucene demo to work and I'm down to setting the classpath in this tutorial http://lucene.apache.org/java/2_3_2/demo.html

                  我在网上搜索过,这些是我找到的 2 个设置 CLASSPATH 的解决方案:

                  I've hunted the web and these wer the 2 solutions I found to set CLASSPATH:

                  CLASSPATH=${CLASSPATH}:/Users/philhunter/Desktop/COM562 Project/lucene-3.0.3/lucene-core-3.0.3.jar
                  

                  setenv CLASSPATH ${CLASSPATH}:/Users/philhunter/Desktop/COM562 Project/lucene-3.0.3/lucene-core-3.0.3.jar 
                  

                  第二个出现错误-bash: setenv: 找不到命令

                  The second one brings up a error -bash: setenv: command not found

                  第一个似乎可以接受,但是当我尝试教程中的下一步时,我得到了一个错误.下一步是运行以下命令:

                  The first one seemed to accept ok but wen i tried the next step in the tutorial i got an error. The next step was to run the following:

                  Phil-hunters-MacBook:webapps philhunter$ java org.apache.lucene.demo.IndexFiles /Users/philhunter/Desktop/COM562 Project/lucene-3.0.3/src
                  

                  这给了我错误:

                  线程 "main" java.lang.NoClassDefFoundError: org/apache/lucene/demo/IndexFiles 中的异常

                  Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/lucene/demo/IndexFiles

                  这让我相信我的 CLASSPATHS 设置不正确.我这样假设是对的吗?我已经尝试过其他教程和演示,并看到很多相同的错误.我是 Lucene 的新手,对 mac 和 Unix shell 脚本相对较新.任何人都知道我是否正确设置了 CLASSPATH 以及这是否是错误的原因?

                  This leads me to believe my CLASSPATHS didnt set correctly. Would I be right in assuming this? I have tried other tutorials and demos and see to get this same error quite a bit. Im new to Lucene and relatively new to mac and Unix shell scripting. Anyone know if I am setting the CLASSPATH correctly and if thats the cause of the errors?

                  推荐答案

                  当你设置像 CLASSPATH 这样的环境变量时,默认情况下它只适用于当前进程(即 shell 进程本身) -它不适用于您在下一行中启动的 java 进程.为了使其可用于其他进程,您需要导出"该变量.在这种情况下,您可以使用以下内容:

                  When you set an environment variable like CLASSPATH then by default it only applies to the current process (i.e. the shell process itself) - it isn't available to the java process you launch in the next line. In order to make it available to other processes you need to "export" the variable. In this case you can use something like:

                  export CLASSPATH=${CLASSPATH}:/Users/philhunter/Desktop/COM562 Project/lucene-3.0.3/lucene-core-3.0.3.jar
                  

                  这基本上是说将 CLASSPATH 变量设置为其当前值加上 lucene jar 的位置,并使新变量可用于从此 shell 启动的任何进程".

                  This basically says "set the CLASSPATH variable to its current value plus the location of the lucene jar, and make the new variable available to any processes launched from this shell".

                  然而,使用 java 设置类路径的常用方法是使用 -classpath-cp 将其作为 java 命令本身的一部分进行 选项.在您的情况下,它看起来像:

                  However, with java the usual way of setting the classpath is to do it as part of the java command itself, using the -classpath or -cp options. In your case it would look something like:

                  Phil-hunters-MacBook:webapps philhunter$ java -cp /Users/philhunter/Desktop/COM562 Project/lucene-3.0.3/lucene-core-3.0.3.jar org.apache.lucene.demo.IndexFiles /Users/philhunter/Desktop/COM562 Project/lucene-3.0.3/src
                  

                  顺便说一句,您在使用 setenv 行时看到的错误是因为 setenv 是 C shell 中用于设置环境变量的命令,但默认的 Macshell(以及您正在使用的 shell)是 bash ,它无法识别 setenv 并通过错误消息让您知道它无法识别它: -bash: setenv: 找不到命令.

                  As an aside, the error you see when using the setenv line is because setenv is the command used in the C shell to set environment variables, but the default Mac shell (and the shell you're using) is bash which doesn't recognise setenv and lets you know it doesn't recognise it with the error message: -bash: setenv: command not found.

                  这篇关于Mac 用户 - 如何在 Mac 中设置 CLASSPATHS(我正在做一个 Lucene 演示)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Lucene Porter Stemmer not public(Lucene Porter Stemmer 未公开)
                  How to index pdf, ppt, xl files in lucene (java based or python or php any of these is fine)?(如何在 lucene 中索引 pdf、ppt、xl 文件(基于 java 或 python 或 php 中的任何一个都可以)?)
                  KeywordAnalyzer and LowerCaseFilter/LowerCaseTokenizer(KeywordAnalyzer 和 LowerCaseFilter/LowerCaseTokenizer)
                  How to search between dates (Hibernate Search)?(如何在日期之间搜索(休眠搜索)?)
                  How to get positions from a document term vector in Lucene?(如何从 Lucene 中的文档术语向量中获取位置?)
                  Java Lucene 4.5 how to search by case insensitive(Java Lucene 4.5如何按不区分大小写进行搜索)
                      <bdo id='0teJd'></bdo><ul id='0teJd'></ul>

                      <small id='0teJd'></small><noframes id='0teJd'>

                      <legend id='0teJd'><style id='0teJd'><dir id='0teJd'><q id='0teJd'></q></dir></style></legend>
                    • <i id='0teJd'><tr id='0teJd'><dt id='0teJd'><q id='0teJd'><span id='0teJd'><b id='0teJd'><form id='0teJd'><ins id='0teJd'></ins><ul id='0teJd'></ul><sub id='0teJd'></sub></form><legend id='0teJd'></legend><bdo id='0teJd'><pre id='0teJd'><center id='0teJd'></center></pre></bdo></b><th id='0teJd'></th></span></q></dt></tr></i><div id='0teJd'><tfoot id='0teJd'></tfoot><dl id='0teJd'><fieldset id='0teJd'></fieldset></dl></div>
                    • <tfoot id='0teJd'></tfoot>

                        <tbody id='0teJd'></tbody>