0

I have multiple versions of java installed. Recently while testing I noticed that cygwin and powershell were running different versions, and figured it was a problem with my path, but it looks to be something stranger. In powershell I get:

PS C:\Users\djpeaco> echo $env:JAVA_HOME
PS C:\Users\pavon> where.exe java
C:\Windows\System32\java.exe
PS C:\Users\pavon> C:\Windows\System32\java.exe -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

And then in cygwin (bash):

$ echo $JAVA_HOME

$ which java
/cygdrive/c/Windows/system32/java
$ /cygdrive/c/Windows/system32/java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode)

I tried restaring both shells, in case there was some environment change that one hadn't picked up, but that didn't solve the problem. Also, cmd.exe behaves the same as powershell. Does anyone know why running the exact same executable in cygwin vs powershell would end up running different JVMs?

1 Answer 1

3

Is Cygwin a 32-bit app? It's possible that, if Cygwin is 32-bit, the operating system is redirecting c:\windows\system32 (the real, 64-bit System32 folder) to c:\windows\syswow64 (the 32-bit System32 folder).

Compare java.exe in c:\windows\system32 to java.exe in c:\windows\syswow64. They might be different.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the quick response! That was exactly what was going on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.