3

Is it possible using a Windows batch file to determine if the version of Java (assuming 7) installed is the 32 bit version or the 64 bit version?

hawkeye
  • 33,004
  • 28
  • 141
  • 288

2 Answers2

4

Here is a small windows script to get you started that will determine Java32 vs Java64 vs JavaNotInstalled.

Tweak as necessary...

@echo off
java -d64 -version >nul 2>&1
if errorlevel 1 goto maybe32bit
echo Java is 64 bit 
goto EXIT
:maybe32bit
where java >nul 2>&1
if errorlevel 1 goto nojava
echo Java is 32 bit 
goto EXIT
:nojava
echo Java is not installed
:EXIT
Java42
  • 7,508
  • 1
  • 31
  • 49
0

Yes, it is possible. The bat file could run java -version and parse the output.

JB Nizet
  • 657,433
  • 87
  • 1,179
  • 1,226