简体   繁体   中英

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). That should not exist in a JRE, only in the JDK.

If you're checking to see if the compiler exists, you could do something like:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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