Issue2353

classification
Title: jython.exe a 32-bit program on 64-bit Win8.1 even when installed with 64-bit Java - related to Issue2346
Type: behaviour Severity: normal
Components: Core, Installer Versions: Jython 2.7
Milestone:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: GelattD, stefan.richthofer, zyasoft
Priority: Keywords:

Created on 2015-05-11.20:16:48 by GelattD, last changed 2015-05-12.16:15:09 by stefan.richthofer.

Messages
msg10049 (view) Author: (GelattD) Date: 2015-05-11.20:34:03
My PC runs 64-bit Win8.1 Pro with both 64-bit and 32-bit Java installed.  JAVA_HOME
is not defined, and only 64-bit Java is on the PATH.

    C:\downloads\Python>set JAVA_HOME
    Environment variable JAVA_HOME not defined
    
    C:\downloads\Python>"C:\Program Files\Java\jre7\bin\java" -version
    java version "1.7.0_71"
    Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
    Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
    
    C:\downloads\Python>java -version
    java version "1.7.0_71"
    Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
    Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Install Jython 2.7.0 with this 64-bit Java:

    C:\downloads\Python>"C:\Program Files\Java\jre7\bin\java" -jar jython-installer-2.7.0.jar
    Ignoring indexes: https://pypi.python.org/simple/
    Downloading/unpacking setuptools
    Downloading/unpacking pip
    Installing collected packages: setuptools, pip
    Successfully installed setuptools pip
    Cleaning up...

Try running the jython.exe that is installed - it runs in 32-bit Java (!?):

    C:\downloads\Python>c:\programs\jython2.7.0\bin\jython
    Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
    [Java HotSpot(TM) Client VM (Oracle Corporation)] on java1.7.0_71
    Type "help", "copyright", "credits" or "license" for more information.
    >>> exit()
    
    C:\downloads\Python>c:\programs\jython2.7.0\bin\jython --print
    java -Xmx512m -Xss1024k -classpath c:\programs\jython2.7.0\jython.jar;. -Dpython.home=c:\programs\jython2.7.0 -Dpython.executable=c:\programs\jython2.7.0\bin\jython.exe -Dpython.launcher.uname=windows
     -Dpython.launcher.tty=true org.python.util.jython

Run the installed jython.jar in 64-bit Java (the default on the machine):

    C:\downloads\Python>java -jar c:\programs\jython2.7.0\jython.jar
    Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
    [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_71
    Type "help", "copyright", "credits" or "license" for more information.
    >>> exit()

These results are consistent with jython.exe being a 32-bit executable even though it was installed by 64-bit Java.

Why not install a 64-bit version of jython.exe when installing with 64-bit Java?  I can work around it, but the current behavior will confuse users.
msg10051 (view) Author: Jim Baker (zyasoft) Date: 2015-05-12.00:50:24
So if only the 64-bit version is installed, there's no issue:

C:\jython2.7.0>bin\jython
Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_55
Type "help", "copyright", "credits" or "license" for more information.

Does 32-bit and 64-bit Java install in the same directory, or different locations? If different locations, you can control with JAVA_HOME, although I guess environment variables are harder to use for this case than on Unix-like systems.

FWIW, I do recommend you run a later version of Java 7 - earlier builds have much slower bytecode verification.
msg10058 (view) Author: (GelattD) Date: 2015-05-12.15:07:50
The 64-bit and 32-bit Java installations are in different locations:

C:\Programs\Jython2.7.0\bin>"C:\Program Files\Java\jre7\bin\java" -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

C:\Programs\Jython2.7.0\bin>"C:\Program Files (x86)\Java\jre7\bin\java" -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) Client VM (build 24.71-b01, mixed mode, sharing)

If I set JAVA_HOME to point to 64-bit Java and run the Jython exe, I get the Issue2346 error:

C:\Programs\Jython2.7.0\bin>set JAVA_HOME
JAVA_HOME="C:\Program Files\Java\jre7"
C:\Programs\Jython2.7.0\bin>jython
Traceback (most recent call last):
  File "<string>", line 444, in <module>
  File "<string>", line 435, in main
  File "Z:\jythondev\jython27\src\shell\build\jython\out00-PYZ.pyz\subprocess", line 522, in call
  File "Z:\jythondev\jython27\src\shell\build\jython\out00-PYZ.pyz\subprocess", line 710, in __init__
  File "Z:\jythondev\jython27\src\shell\build\jython\out00-PYZ.pyz\subprocess", line 958, in _execute_child
WindowsError: [Error 5] Access is denied
msg10059 (view) Author: Jim Baker (zyasoft) Date: 2015-05-12.15:19:43
You are pointing at the wrong location; JAVA_HOME must be the parent directory of the bin directory for java:

C:\jython2.7.0>set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_55

C:\jython2.7.0>bin\jython
Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_55
Type "help", "copyright", "credits" or "license" for more information.
>>>
History
Date User Action Args
2015-05-12 16:15:09stefan.richthofersetnosy: + stefan.richthofer
2015-05-12 15:19:43zyasoftsetmessages: + msg10059
2015-05-12 15:07:50GelattDsetmessages: + msg10058
2015-05-12 00:50:25zyasoftsetnosy: + zyasoft
messages: + msg10051
2015-05-11 20:34:04GelattDsetmessages: + msg10049
2015-05-11 20:19:04GelattDsettitle: python.exe a 32-bit program on 64-bit Win8.1 - related to Issue2346 -> jython.exe a 32-bit program on 64-bit Win8.1 even when installed with 64-bit Java - related to Issue2346
2015-05-11 20:16:48GelattDcreate