无法在命令行中运行beanshell
我正在阅读 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信您跳过了设置 JAVA_HOME 环境变量。根据readme.txt文件,您需要:
假设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
口译员。
从命令提示符执行:
cd /DC:\iWeb2\build
ant
Ant 将执行 C:\iWeb2\build\build.xml 构建文件中的默认目标。它
将构建所有源代码并准备“C:\iWeb2\deploy”目录。
I believe you skipped setting your JAVA_HOME environment variable. According to the readme.txt file, you need to:
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.
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.
确保您的 JAVA_HOME 环境变量没有任何空格,否则批处理文件的最后一行将失败。例如,如果您(像我一样,天真地)将Java安装在C:\ Program Files \ Java中,则必须使用引号,例如
但即使在正确设置后,我也遇到了问题。最后,我只是在最后一行的命令部分加上引号,例如
,一切都运行正常。
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.
But even after setting this correctly, I had problems. Finally, I just put quotes around the command part of the final line, e.g.
and everything ran properly.