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
  • 34,745
  • 30
  • 150
  • 304

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,628
  • 1
  • 32
  • 50
0

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

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255