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 win开发者_开发技巧dow 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?
I believe you skipped setting your JAVA_HOME environment variable. According to the readme.txt file, you need to:
- 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.
- 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.
- Start beanshell
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.
精彩评论