当前位置: 首页 > 知识库问答 >
问题:

TeamCity server无法找到Java可执行文件,即使我已经设置了它

易成双
2023-03-14

大约1个月前,我仍然可以运行TeamCity服务器,但到目前为止,它说Java1.8版的可执行文件找不到。

我设置了环境变量:

JAVA\U HOME=C:\Program Files\JAVA\jdk-11.0.1

JRE\u HOME=C:\Program Files\Java\jre1.8.0\u 192

CATALINA_HOME=C:\apache-tomcat-9.0.12

在Path变量中,我将其设置为:

但它仍然说它找不到JAVA_HOME或JRE_HOME。

我在下面附上的TeamCity服务器日志。

[2018-11-27 10:50:45,773] FileTaskSettings                  [Info] Parsing service settings
[2018-11-27 10:50:45,774] FileTaskSettings                  [Info] Program to execute:   C:\WINDOWS\system32\cmd.exe
[2018-11-27 10:50:45,774] FileTaskSettings                  [Info] Program arguments:    /c teamcity-server.bat run service
[2018-11-27 10:50:45,774] FileTaskSettings                  [Info] Program work dir:     c:\TeamCity\bin
[2018-11-27 10:50:45,774] FileTaskSettings                  [Info] Program stop timeout: 900000
[2018-11-27 10:50:45,774] CreateServiceSettingsAction       [Info] Service log file is set to: c:\TeamCity\logs\teamcity-winservice.log
[2018-11-27 10:50:45,774] CreateServiceSettingsAction       [Info] Installing service unser LOCAL_SYSTEM account
[2018-11-27 10:50:45,776] CreateServiceCommand              [Info] Service 'TeamCity' was created
[2018-11-27 10:50:45,778] CreateServiceAction               [Info] 
[2018-11-27 10:50:45,778] CreateServiceAction               [Info] Use the folloging commands to start/stop the service:
[2018-11-27 10:50:45,778] CreateServiceAction               [Info]   net.exe start TeamCity
[2018-11-27 10:50:45,778] CreateServiceAction               [Info]     to start service
[2018-11-27 10:50:45,778] CreateServiceAction               [Info] 
[2018-11-27 10:50:45,778] CreateServiceAction               [Info]   net.exe stop TeamCity
[2018-11-27 10:50:45,778] CreateServiceAction               [Info]     to stop service
[2018-11-27 10:50:45,778] CreateServiceAction               [Info] 
[2018-11-27 11:20:16,283] FileTaskSettings                  [Info] Parsing service settings
[2018-11-27 11:20:16,283] FileTaskSettings                  [Info] Program to execute:   C:\WINDOWS\system32\cmd.exe
[2018-11-27 11:20:16,283] FileTaskSettings                  [Info] Program arguments:    /c teamcity-server.bat run service
[2018-11-27 11:20:16,283] FileTaskSettings                  [Info] Program work dir:     c:\TeamCity\bin
[2018-11-27 11:20:16,283] FileTaskSettings                  [Info] Program stop timeout: 900000
[2018-11-27 11:20:16,284] CreateServiceSettingsAction       [Info] Service log file is set to: c:\TeamCity\logs\teamcity-winservice.log
[2018-11-27 11:20:16,284] CreateServiceSettingsAction       [Info] Installing service unser LOCAL_SYSTEM account
[2018-11-27 11:20:16,286] CreateServiceCommand              [Info] Service 'TeamCity' was created
[2018-11-27 11:20:16,287] CreateServiceAction               [Info] 
[2018-11-27 11:20:16,287] CreateServiceAction               [Info] Use the folloging commands to start/stop the service:
[2018-11-27 11:20:16,287] CreateServiceAction               [Info]   net.exe start TeamCity
[2018-11-27 11:20:16,287] CreateServiceAction               [Info]     to start service
[2018-11-27 11:20:16,287] CreateServiceAction               [Info] 
[2018-11-27 11:20:16,288] CreateServiceAction               [Info]   net.exe stop TeamCity
[2018-11-27 11:20:16,288] CreateServiceAction               [Info]     to stop service
[2018-11-27 11:20:16,288] CreateServiceAction               [Info] 
[2018-11-27 11:20:28,729] ThreadedServiceTask               [Info] CallStartService
[2018-11-27 11:20:28,729] FileTaskSettings                  [Info] Parsing service settings
[2018-11-27 11:20:28,730] FileTaskSettings                  [Info] Program to execute:   C:\WINDOWS\system32\cmd.exe
[2018-11-27 11:20:28,730] FileTaskSettings                  [Info] Program arguments:    /c teamcity-server.bat run service
[2018-11-27 11:20:28,730] FileTaskSettings                  [Info] Program work dir:     c:\TeamCity\bin
[2018-11-27 11:20:28,730] FileTaskSettings                  [Info] Program stop timeout: 900000
[2018-11-27 11:20:28,834] console                           [Info] Starting TeamCity server
[2018-11-27 11:20:28,835] console                           [Info] Looking for installed Java...
[2018-11-27 11:20:29,138] console                           [Info] 'findstr' is not recognized as an internal or external command,
[2018-11-27 11:20:29,138] console                           [Info] operable program or batch file.
[2018-11-27 11:20:29,340] console                           [Info] 'findstr' is not recognized as an internal or external command,
[2018-11-27 11:20:29,340] console                           [Info] operable program or batch file.
[2018-11-27 11:20:29,845] console                           [Info] 'findstr' is not recognized as an internal or external command,
[2018-11-27 11:20:29,845] console                           [Info] operable program or batch file.
[2018-11-27 11:20:30,350] console                           [Info] 'findstr' is not recognized as an internal or external command,
[2018-11-27 11:20:30,350] console                           [Info] operable program or batch file.
[2018-11-27 11:20:30,451] console                           [Info] 'findstr' is not recognized as an internal or external command,
[2018-11-27 11:20:30,451] console                           [Info] operable program or batch file.
[2018-11-27 11:20:30,653] console                           [Info] 'findstr' is not recognized as an internal or external command,
[2018-11-27 11:20:30,653] console                           [Info] operable program or batch file.
[2018-11-27 11:20:30,653] console                           [Info] 
[2018-11-27 11:20:30,653] console                           [Info] Java executable of version 1.8 is not found:
[2018-11-27 11:20:30,653] console                           [Info] - Java executable is not found under the specified directories: "c:\TeamCity\jre"
[2018-11-27 11:20:30,653] console                           [Info] - Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
[2018-11-27 11:20:30,653] console                           [Info] - Path to JVM is not found in Windows registry
[2018-11-27 11:20:30,653] console                           [Info] - Java executable is not found in the default locations
[2018-11-27 11:20:30,653] console                           [Info] - Java executable is not found in the directories listed in the PATH environment variable
[2018-11-27 11:20:30,653] console                           [Info] 
[2018-11-27 11:20:30,653] console                           [Info] Please make sure either JAVA_HOME or JRE_HOME environment variable is defined and is pointing to the root directory of the valid Java (JRE) installation
[2018-11-27 11:20:30,653] console                           [Info] 
[2018-11-27 11:20:30,653] console                           [Info] Environment variable FJ_DEBUG can be set to enable debug output
[2018-11-27 11:20:30,653] console                           [Info] 
[2018-11-27 11:20:30,653] console                           [Info] Java not found. Cannot start TeamCity server. Please ensure JDK or JRE is installed and JAVA_HOME environment variable points to it.
[2018-11-27 11:20:30,754] console                           [Info] Server exited unexpectedly with code 1 and will be restarted
[2018-11-27 11:20:30,754] console                           [Info] Starting TeamCity server
[2018-11-27 11:20:30,754] console                           [Info] Looking for installed Java...
[2018-11-27 11:20:30,956] console                           [Info] 'findstr' is not recognized as an internal or external command,
[2018-11-27 11:20:30,956] console                           [Info] operable program or batch file.
[2018-11-27 11:20:31,158] console                           [Info] 'findstr' is not recognized as an internal or external command,
[2018-11-27 11:20:31,158] console                           [Info] operable program or batch file.
[2018-11-27 11:20:31,360] console                           [Info] 'findstr' is not recognized as an internal or external command,
[2018-11-27 11:20:31,360] console                           [Info] operable program or batch file.
[2018-11-27 11:20:31,764] console                           [Info] 'findstr' is not recognized as an internal or external command,
[2018-11-27 11:20:31,764] console                           [Info] operable program or batch file.
[2018-11-27 11:20:31,966] console                           [Info] 'findstr' is not recognized as an internal or external command,
[2018-11-27 11:20:31,966] console                           [Info] operable program or batch file.
[2018-11-27 11:20:32,067] console                           [Info] 'findstr' is not recognized as an internal or external command,
[2018-11-27 11:20:32,067] console                           [Info] operable program or batch file.
[2018-11-27 11:20:32,067] console                           [Info] 
[2018-11-27 11:20:32,067] console                           [Info] Java executable of version 1.8 is not found:
[2018-11-27 11:20:32,067] console                           [Info] - Java executable is not found under the specified directories: "c:\TeamCity\jre"
[2018-11-27 11:20:32,067] console                           [Info] - Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
[2018-11-27 11:20:32,067] console                           [Info] - Path to JVM is not found in Windows registry
[2018-11-27 11:20:32,067] console                           [Info] - Java executable is not found in the default locations
[2018-11-27 11:20:32,067] console                           [Info] - Java executable is not found in the directories listed in the PATH environment variable
[2018-11-27 11:20:32,067] console                           [Info] 
[2018-11-27 11:20:32,067] console                           [Info] Please make sure either JAVA_HOME or JRE_HOME environment variable is defined and is pointing to the root directory of the valid Java (JRE) installation
[2018-11-27 11:20:32,067] console                           [Info] 
[2018-11-27 11:20:32,067] console                           [Info] Environment variable FJ_DEBUG can be set to enable debug output
[2018-11-27 11:20:32,067] console                           [Info] 
[2018-11-27 11:20:32,067] console                           [Info] Java not found. Cannot start TeamCity server. Please ensure JDK or JRE is installed and JAVA_HOME environment variable points to it.
[2018-11-27 11:20:32,067] console                           [Info] Server exited unexpectedly with code 1 and will be restarted
[2018-11-27 11:20:32,168] console                           [Info] Starting TeamCity server
[2018-11-27 11:20:32,168] console                           [Info] Looking for installed Java...
[2018-11-27 11:20:32,370] console                           [Info] 'findstr' is not recognized as an internal or external command,
[2018-11-27 11:20:32,370] console                           [Info] operable program or batch file.
[2018-11-27 11:20:32,571] console                           [Info] 'findstr' is not recognized as an internal or external command,
[2018-11-27 11:20:32,571] console                           [Info] operable program or batch file.
[2018-11-27 11:20:32,773] console                           [Info] 'findstr' is not recognized as an internal or external command,
[2018-11-27 11:20:32,773] console                           [Info] operable program or batch file.
[2018-11-27 11:20:33,177] console                           [Info] 'findstr' is not recognized as an internal or external command,
[2018-11-27 11:20:33,177] console                           [Info] operable program or batch file.
[2018-11-27 11:20:33,379] console                           [Info] 'findstr' is not recognized as an internal or external command,
[2018-11-27 11:20:33,379] console                           [Info] operable program or batch file.
[2018-11-27 11:20:33,480] console                           [Info] 'findstr' is not recognized as an internal or external command,
[2018-11-27 11:20:33,480] console                           [Info] operable program or batch file.
[2018-11-27 11:20:33,480] console                           [Info] 
[2018-11-27 11:20:33,480] console                           [Info] Java executable of version 1.8 is not found:
[2018-11-27 11:20:33,480] console                           [Info] - Java executable is not found under the specified directories: "c:\TeamCity\jre"
[2018-11-27 11:20:33,480] console                           [Info] - Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
[2018-11-27 11:20:33,480] console                           [Info] - Path to JVM is not found in Windows registry
[2018-11-27 11:20:33,480] console                           [Info] - Java executable is not found in the default locations
[2018-11-27 11:20:33,480] console                           [Info] - Java executable is not found in the directories listed in the PATH environment variable
[2018-11-27 11:20:33,480] console                           [Info] 
[2018-11-27 11:20:33,480] console                           [Info] Please make sure either JAVA_HOME or JRE_HOME environment variable is defined and is pointing to the root directory of the valid Java (JRE) installation
[2018-11-27 11:20:33,480] console                           [Info] Team
[2018-11-27 11:20:33,480] console                           [Info] Environment variable FJ_DEBUG can be set to enable debug output
[2018-11-27 11:20:33,480] console                           [Info] 
[2018-11-27 11:20:33,480] console                           [Info] Java not found. Cannot start TeamCity server. Please ensure JDK or JRE is installed and JAVA_HOME environment variable points to it.
[2018-11-27 11:20:33,480] console                           [Info] Server exited unexpectedly with code 1 and restart limit (3) is reached
[2018-11-27 11:20:33,481] ProcessCommand                    [Info] Process exited with code: 0
[2018-11-27 11:20:33,581] ServiceExecuteProcessTask        [Error] Service process exited without service stop request

共有3个答案

戚高洁
2023-03-14

我也遇到了这个。事实证明,答案是调试日志中早些时候的“findstr”错误。由于某种原因,我的Windows build server在其路径上丢失了“C:\Windows\System32”teamcity内部批处理文件使用Findstr来解析Java版本。这会导致启动脚本回退,并假设未安装Java。一旦我将这个目录添加回路径中,服务器就正常启动了。

柯瀚玥
2023-03-14

我有一个类似的问题,并能够通过以下方式解决它:

  1. 下载TeamCity的.exe安装程序
华星驰
2023-03-14

在阅读了这个答案后,我找到了我的解决方案,“…”没有被识别为内部或外部命令、可操作程序或批处理文件的原因是什么。基本上,TeamCity只获取JRE_HOME变量,而不是Path变量,因此其中没有。当设置TeamCity时,我只需编辑JRE_主页,它就起作用了。

 类似资料:
  • 问题内容: 我刚刚在Windows Vista上安装了JDK。之后,我为4个环境变量设置了适当的值:classpath,include,lib,path。之后,我可以编译我的HelloWorld程序(我得到了* .class文件)。但是,当我尝试执行已编译的程序(我键入java HelloWorldApp)时,它不起作用。Java写了很多东西,最后写成“找不到主类:HelloWorldApp”。请

  • 我试图设置销售(基于Django)。我做了一个“python-m pip安装-rrequirements.txt”,如网站上所述。事情进行得很顺利,直到安装的收集心理2二进制==2.8.3,然后错误抛出。我安装了Postgre,我在窗口上。我还添加了pg_config环境变量的路径,因为它说pg_config可执行文件未找到。我不确定如何进行。 下面是显示的错误: 感谢您的帮助。谢谢

  • 问题内容: 我在Mac osx 10.7.3中遇到Java的可悲问题。以前我安装了它,并且工作正常。在一段时间后对.bash_profile和.profile文件进行了一些更改之后,出现类似以下错误 每当我尝试在终端上运行“ javac”或“ java”时。 给出类似的输出: 我的.bash_profile看起来像: 输出 它困扰了我很长时间,并且卸载和安装Java并没有帮助我。 我是Mac的新手

  • 我的mac osx 10.7.3中的Java出现了一个可悲的问题。之前我安装了它,它工作正常。经过一段时间对.bash_profile和.profile文件进行了一些更改后,出现了如下错误 每当我试图在终端中运行“javac”或“java”时。 给出如下输出: 我的.bash_profile如下所示: 输出 它困扰了我好几天,卸载和安装java对我的运气没有帮助。 我是Mac中的新手,需要帮助来解

  • 问题内容: 即使设置正确,我仍然无法“运行”或“运行”来找到自己的软件包。我究竟做错了什么? 问题答案: 它不起作用,因为您的源文件不在名为的目录中。并尝试匹配目录,而不是源文件。 设置为有效目录,例如 移动到与建筑应该只是罚款。 建议的其他步骤: 添加到您的依据: 移至的子文件夹,例如 现在应该在其中创建一个可执行文件,可以通过在终端中键入来调用该可执行文件。

  • 我安装了Java JDK,然后在高级设置中设置了系统环境的路径,但在命令提示符中仍然无法识别。。 这是截图