hawkeye
hawkeye

Reputation: 35702

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

Is it possible to tell if a JAVA_HOME system environment variable contains a JDK within a Windows batch file?

Upvotes: 0

Views: 224

Answers (2)

Vivin Paliath
Vivin Paliath

Reputation: 95518

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

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

Upvotes: 2

TofuBeer
TofuBeer

Reputation: 61526

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.

Upvotes: 2

Related Questions