简体   繁体   English

您如何判断JAVA_HOME在Windows批处理文件中是否包含JDK?

[英]How can you tell if JAVA_HOME contains a JDK in a Windows batch file?

是否可以判断Windows批处理文件中的JAVA_HOME系统环境变量是否包含JDK?

You could look for %JAVA_HOME%\\bin\\javac.exe (or whatever it is, I assume exe). 您可以查找%JAVA_HOME%\\ bin \\ javac.exe(或者无论如何,我都认为是exe)。 That should not exist in a JRE, only in the JDK. 那在JRE中不应该存在,仅在JDK中存在。

If you're checking to see if the compiler exists, you could do something like: 如果要检查编译器是否存在,可以执行以下操作:

if exist %JAVA_HOME%\bin\javac.exe (
   ...
) else (
   ...
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM