Sung Qee
Sung Qee

Reputation: 345

"java -version" command has different results in Inno Setup

I am trying to build up a installer for my software by Inno Setup.

But a weird thing happened:

I try to run the Pascal code to get the Java version in Inno Setup script

Exec('cmd.exe', '/c java  -version 2> ' + tempDirPath+jdkVersionInfoFile, '', 
     SW_HIDE, ewWaitUntilTerminated, ResultCode)

The result is java verison "1.6".

And when I typed the command java -version in console window, then I get the result is java version "1.8".

Why are the results different?

Upvotes: 3

Views: 685

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202514

While I cannot imagine how exactly this happens on your machine without more details, differences like this typically stem from the fact that Inno Setup is 32-bit application.

It's likely that 32-bit version of Java is run by Inno Setup (32-bit application) and 64-bit version of Java is run by Windows command interpreter (64-bit application). And you have different versions installed for these platforms.

(Assuming that you run 64-bit version of Windows).

See Install Mode: 32-bit vs. 64-bit article in Inno Setup documentation.

Upvotes: 2

Related Questions