无法在命令行中运行beanshell

发布于 2024-11-11 03:31:11 字数 2499 浏览 2 评论 0原文

我正在阅读 Haralambos Marmanis 和 Dmitry Babenko 所著的《智能网络算法》一书。我正在尝试使用 beanshell 运行书中的脚本。我可以按照本书的要求在命令行解释器中运行java和ant。我从 http://code.google.com/p/ 下载了这本书的源代码yooreeka/downloads/list。我在目录 c:/iWeb2 中提取并构建了所有内容。要启动 beanshell,我应该进入目录 C:\iWeb2\deploy\bin\bsc.bat 它应该打开 beanshell 的控制台窗口,我认为它确实如此,因为控制台的标题从命令提示符更改为 beanshell。但它打印出以下内容

C:\iWeb2\deploy\bin>bsc

C:\iWeb2\deploy\bin>echo off

Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem; C:\PROGRA~1\COMMON~ 1\ULEADS~1\MPEG;C:\Program Files\Java\jdk1.6.0_17\bin;C:\Python25;C:\Windows\Sys tem32\WindowsPowerShell\v1.0\;C:\apache-ant-1.8.2-bin\apache-ant-1.8.2\bin;C:\Pr gram 文件\Google\google_appengine\

PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

CLASSPATH=C:\iWeb2\deploy\ lib\bsh-2.0b4.jar;;C:\iWeb2\deploy\lib\activation.jar; C:\iWeb2\deploy\lib\amazon-ecs-2007-07-16-java-library.jar;C:\iWeb2\deploy\lib\b las.jar;C:\iWeb2\deploy\lib\commons-codec-1.3.jar;C:\iWeb2\deploy\lib\commons-ht tpclient-3.1.jar;C:\iWeb2\deploy\lib\commons-lang-2.3.jar;C:\iWeb2\deploy\lib\co mmons-logging-1.1.1.jar;C:\iWeb2\deploy\lib\f2jutil.jar;C:\iWeb2\deploy\lib\jaxb -all-deps.jar;C:\iWeb2\deploy\lib\jaxb-api.jar;C:\iWeb2\deploy\lib\jaxb-impl.jar ;C:\iWeb2\deploy\lib\jaxb-xjc.jar;C:\iWeb2\deploy\lib\jfreechart.jar;C:\iWeb2\de ploy\lib\jgraph.jar;C:\iWeb2\deploy\lib\jigg-0.1.jar;C:\iWeb2\deploy\lib\rooster .jar;C:\iWeb2\deploy\lib\jsr173_1.0_api.jar;C:\iWeb2\deploy\lib\junit-4.1.jar;C: \iWeb2\deploy\lib\lapack.jar;C:\iWeb2\deploy\lib\lucene-analyzers-2.3.0.jar;C:\i Web2\deploy\lib\lucene-core-2.3.0.jar;C:\iWeb2\deploy\lib\lucene-demos-2.3.0.jar ;C:\iWeb2\deploy\lib\lucene-memory-2.3.0.jar;C:\iWeb2\deploy\lib\nekohtml.jar;C: \iWeb2\deploy\lib\poi-3.0.2-FINAL-20080204.jar;C:\iWeb2\deploy\lib\resolver.jar; C:\iWeb2\deploy\lib\secondstring-20070327.jar;C:\iWeb2\deploy\lib\serializer.jar ;C:\iWeb2\deploy\lib\SuperCSV-1.16.jar;C:\iWeb2\deploy\lib\tm-extractors-1.0.jar ;C:\iWeb2\deploy\lib\xercesImpl.jar;C:\iWeb2\deploy\lib\xml-apis.jar;C:\iWeb2\de ploy\lib\drools-core-4.0.4.jar;C:\iWeb2\deploy\lib\drools-compiler-4.0.4.jar;C:\ iWeb2\deploy\lib\antlr-runtime-3.0.jar;C:\iWeb2\deploy\lib\janino-2.5.10.jar;C:\ iWeb2\deploy\lib\mvel14-1.2.21.jar;C:\iWeb2\deploy\lib\iweb2.jar;C:\iWeb2\deploy

\conf

环境变量 JAVA_HOME 未定义

系统找不到指定的路径。

C:\iWeb2\deploy\bin> 可能是什么问题?

Am reading the book Algorithms of the intelligent web by Haralambos Marmanis and Dmitry Babenko. Am trying to run the scripts in the book using beanshell. I can run java and ant in my command line interpreter as required by the book. I downloaded the source code of the book from http://code.google.com/p/yooreeka/downloads/list. I extracted and built everything int he directory c:/iWeb2.To start beanshell am supposed to go the directory C:\iWeb2\deploy\bin\bsc.bat
It should open the console window for beanshell which i think it does because the title of the console changes fron command prompt to beanshell. but it prints out the following

C:\iWeb2\deploy\bin>bsc

C:\iWeb2\deploy\bin>echo off

Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\PROGRA~1\COMMON~
1\ULEADS~1\MPEG;C:\Program Files\Java\jdk1.6.0_17\bin;C:\Python25;C:\Windows\Sys
tem32\WindowsPowerShell\v1.0\;C:\apache-ant-1.8.2-bin\apache-ant-1.8.2\bin;C:\Pr
ogram Files\Google\google_appengine\

PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

CLASSPATH=C:\iWeb2\deploy\lib\bsh-2.0b4.jar;;C:\iWeb2\deploy\lib\activation.jar;
C:\iWeb2\deploy\lib\amazon-ecs-2007-07-16-java-library.jar;C:\iWeb2\deploy\lib\b
las.jar;C:\iWeb2\deploy\lib\commons-codec-1.3.jar;C:\iWeb2\deploy\lib\commons-ht
tpclient-3.1.jar;C:\iWeb2\deploy\lib\commons-lang-2.3.jar;C:\iWeb2\deploy\lib\co
mmons-logging-1.1.1.jar;C:\iWeb2\deploy\lib\f2jutil.jar;C:\iWeb2\deploy\lib\jaxb
-all-deps.jar;C:\iWeb2\deploy\lib\jaxb-api.jar;C:\iWeb2\deploy\lib\jaxb-impl.jar
;C:\iWeb2\deploy\lib\jaxb-xjc.jar;C:\iWeb2\deploy\lib\jfreechart.jar;C:\iWeb2\de
ploy\lib\jgraph.jar;C:\iWeb2\deploy\lib\jigg-0.1.jar;C:\iWeb2\deploy\lib\rooster
.jar;C:\iWeb2\deploy\lib\jsr173_1.0_api.jar;C:\iWeb2\deploy\lib\junit-4.1.jar;C:
\iWeb2\deploy\lib\lapack.jar;C:\iWeb2\deploy\lib\lucene-analyzers-2.3.0.jar;C:\i
Web2\deploy\lib\lucene-core-2.3.0.jar;C:\iWeb2\deploy\lib\lucene-demos-2.3.0.jar
;C:\iWeb2\deploy\lib\lucene-memory-2.3.0.jar;C:\iWeb2\deploy\lib\nekohtml.jar;C:
\iWeb2\deploy\lib\poi-3.0.2-FINAL-20080204.jar;C:\iWeb2\deploy\lib\resolver.jar;
C:\iWeb2\deploy\lib\secondstring-20070327.jar;C:\iWeb2\deploy\lib\serializer.jar
;C:\iWeb2\deploy\lib\SuperCSV-1.16.jar;C:\iWeb2\deploy\lib\tm-extractors-1.0.jar
;C:\iWeb2\deploy\lib\xercesImpl.jar;C:\iWeb2\deploy\lib\xml-apis.jar;C:\iWeb2\de
ploy\lib\drools-core-4.0.4.jar;C:\iWeb2\deploy\lib\drools-compiler-4.0.4.jar;C:\
iWeb2\deploy\lib\antlr-runtime-3.0.jar;C:\iWeb2\deploy\lib\janino-2.5.10.jar;C:\
iWeb2\deploy\lib\mvel14-1.2.21.jar;C:\iWeb2\deploy\lib\iweb2.jar;C:\iWeb2\deploy

\conf

Environment variable JAVA_HOME not defined

The system cannot find the path specified.

C:\iWeb2\deploy\bin>
What could be the problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不甘平庸 2024-11-18 03:31:11

我相信您跳过了设置 JAVA_HOME 环境变量。根据readme.txt文件,您需要:

  1. 配置您的java环境

假设java jdk位于C:\jdk1.5.0_12并且
Ant 位于 C:\apache-ant-1.7.0 使用以下命令:

SET JAVA_HOME=C:\jdk1.5.0_12
设置 ANT_HOME=C:\apache-ant-1.7.0
SET PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin;%PATH%

此时您应该能够从命令行运行 java 和 ant,而无需
错误。如果您只为当前命令行配置了环境
解释器确保您在同一个实例中执行步骤 3 和 4
口译员。

  1. 为项目运行 ant 构建文件:

从命令提示符执行:

cd /DC:\iWeb2\build
ant

Ant 将执行 C:\iWeb2\build\build.xml 构建文件中的默认目标。它
将构建所有源代码并准备“C:\iWeb2\deploy”目录。

  1. 启动豆壳

I believe you skipped setting your JAVA_HOME environment variable. According to the readme.txt file, you need to:

  1. Configure your java environment

Assuming that java jdk is in C:\jdk1.5.0_12 and
Ant is in C:\apache-ant-1.7.0 use the following commands:

SET JAVA_HOME=C:\jdk1.5.0_12
SET ANT_HOME=C:\apache-ant-1.7.0
SET PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin;%PATH%

At this point you should be able to run java and ant from command line without
errors. If you've only configured environment for your current command line
interpreter make sure that you perform steps 3 and 4 in the same instance of
interpreter.

  1. Run ant build file for the project:

From command prompt execute:

cd /D C:\iWeb2\build
ant

Ant will execute default target from C:\iWeb2\build\build.xml build file. It
will build all source code and will prepare 'C:\iWeb2\deploy' directory.

  1. Start beanshell
混浊又暗下来 2024-11-18 03:31:11

确保您的 JAVA_HOME 环境变量没有任何空格,否则批处理文件的最后一行将失败。例如,如果您(像我一样,天真地)将Java安装在C:\ Program Files \ Java中,则必须使用引号,例如

 set JAVA_HOME="C:\Program Files\Java\jdk1.7.0_02"

但即使在正确设置后,我也遇到了问题。最后,我只是在最后一行的命令部分加上引号,例如

 "%JAVA_HOME%\bin\java" -Duser.home=%IWEB2_HOME%\deploy\bin -Xms256M -Xmx1280M -cp %CLASSPATH% bsh.Interpreter

,一切都运行正常。

Make sure that your JAVA_HOME environment variable does not have any spaces or the last line of the batch file will fail. For example, if you (like me, naively) installed Java in C:\Program Files\Java, you have to use quotes, e.g.

 set JAVA_HOME="C:\Program Files\Java\jdk1.7.0_02"

But even after setting this correctly, I had problems. Finally, I just put quotes around the command part of the final line, e.g.

 "%JAVA_HOME%\bin\java" -Duser.home=%IWEB2_HOME%\deploy\bin -Xms256M -Xmx1280M -cp %CLASSPATH% bsh.Interpreter

and everything ran properly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文