Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6188751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:17:24+00:00 2026-05-24T02:17:24+00:00

In my BAT file I would like to have something like: set javaVersion=… if

  • 0

In my BAT file I would like to have something like:

set javaVersion=...

if %javaVersion% equ 32 (
  echo "do 32 Java routine"
) else (
  echo "do non-32 Java routine"
)

On a 64bit machine, with JRE 64bit installed, in the registry under HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment and HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.6 I see almost the same values as on a 32bit machine with JRE 32bit installed:

HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment
    CurrentVersion:       1.6
    Java6FamilyVersion:   1.6.0_26

HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.6
    JavaHome:             C:\Program Files\Java\jre6
    MicroVersion:         0
    RuntimeLib:           C:\Program Files\Java\jre6\bin\client\jvm.dll

Therefore, I could check if it is 64bit Java by checking if PROGRAMFILES(X86) is defined and if JavaHome points to location which starts with C:\Program Files\.

But is there a better option?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:17:25+00:00Added an answer on May 24, 2026 at 2:17 am

    You could capture the output of java -version – it’s in there.
    Here’s the output on my mac:

    java version "1.6.0_26"
    Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
    Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)
    

    You should find either “64-Bit” or “32-Bit” in the output.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have bat file like below with name myBat.bat 1) @echo off set CLASSPATH=%CLASSPATH%;C:\Documents
I would like to have a BAT file open a sql server script. Currently
I have a .bat file with the following structure: istruction1[newline] I would like to
I have this line inside my BAT file: Example1Server.exe I would like to execute
I have a batch file (.BAT) and would like to capture its output into
You would think that launching a bat file from Java would be an easy
I would like to launch one of my apps inside a .bat file but
Problem I have a file which contains such text (nothing else) 2010-10-05 I would
I have a situation where I would like the a batch file to do
I would like to make a .bat file that would add some string at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.