错误: - 'java'未被识别为内部或外部命令

时间:2012-08-26 11:49:32

标签: java ant h2

我试过在ANT下运行Activiti BPM工具,但是我收到以下错误: - 错误: - 'java'未被识别为内部或外部命令;当我尝试在Windows 7下使用CMD命令行启动演示应用程序时,我收到以下错误: -

C:\activiti-5.10\activiti-5.10\setup>ant demo.start
    Buildfile: C:\activiti-5.10\activiti-5.10\setup\build.xml

    demo.install:

    internal.cfg.create:
     [copy] Copying 1 file to C:\activiti-5.10\activiti-5.10\setup\build\activit
i-cfg
      [zip] Building zip: C:\activiti-5.10\activiti-5.10\setup\build\activiti-cf
g.jar
     [echo] copying configuration to ../workspace/activiti-engine-examples/src/m
ain/config
    [unzip] Expanding: C:\activiti-5.10\activiti-5.10\setup\build\activiti-cfg.j
ar into C:\activiti-5.10\activiti-5.10\workspace\activiti-engine-examples\src\ma
in\config

internal.classpath.libs:

internal.taskdef.launch:

h2.start:
     [echo] starting H2 database...
   [launch] launching cmd 'C:\activiti-5.10\activiti-5.10\apps\h2\h2.start.bat '
 in dir 'C:\activiti-5.10\activiti-5.10\apps\h2'
   [launch] waiting for launch completion msg 'TCP server running'...
   [launch]   'java' is not recognized as an internal or external command,
   [launch]   operable program or batch file.
   [launch] launched process completed
     [echo] H2 database started

tomcat.start:
   [launch] launching cmd 'C:\activiti-5.10\activiti-5.10\apps\apache-tomcat-6.0
.32\bin\startup.bat ' in dir 'C:\activiti-5.10\activiti-5.10\apps\apache-tomcat-
6.0.32\bin'
   [launch] waiting for launch completion msg 'Using CLASSPATH:'...
   [launch]   Using CATALINA_BASE:   "C:\activiti-5.10\activiti-5.10\apps\apache
-tomcat-6.0.32"
   [launch]   Using CATALINA_HOME:   "C:\activiti-5.10\activiti-5.10\apps\apache
-tomcat-6.0.32"
   [launch]   Using CATALINA_TMPDIR: "C:\activiti-5.10\activiti-5.10\apps\apache
-tomcat-6.0.32\temp"
   [launch]   Using JRE_HOME:        "C:\Program Files\Java\jdk1.7.0_06"
   [launch]   Using CLASSPATH:       "C:\activiti-5.10\activiti-5.10\apps\apache
-tomcat-6.0.32\bin\bootstrap.jar"

explorer.browser.open:

demo.start:

BUILD SUCCESSFUL
Total time: 5 seconds

有谁知道出了什么问题? BR

3 个答案:

答案 0 :(得分:3)

  

错误: - 'java'未被识别为内部或外部命令;

这意味着java.exe不属于您的PATH%JAVA_HOME%\bin添加到PATH,其中JAVA_HOME是您的java安装目录

答案 1 :(得分:3)

只需将C:\Program Files\Java\jdk1.7.0_06\bin添加到您的路径中即可。

原因是批处理文件C:\activiti-5.10\activiti-5.10\apps\h2\h2.start.bat具有原始java命令,该命令依赖于java.exe在PATH上。

答案 2 :(得分:0)

我有类似的问题。出于某种原因,java JDK在C:\ Program Files(x86)\ Java BUT 中正确安装在路径中,它设置为C:\ Program Files \ Java ...一旦我更正了路径变量它解决了这个问题。

另外,请注意,如果你有Jenkins和Java使用相同的端口号,这可能会导致一切正常,你需要让它们使用单​​独的端口号。要检查Jenkins是否作为服务运行,然后重新启动Tomcat