Opened 9 years ago

Closed 8 years ago

#47036 closed defect (fixed)

jython installation hardcodes JAVA_HOME such that jython will fail if a user upgrades the Java installation

Reported by: posita (Matt Bogosian) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.3.3
Keywords: Cc:
Port: jython

Description

To reproduce

  • install an older version of Java (e.g., jdk1.7.0_67)
  • install jython
  • upgrade Java (e.g., to jdk1.7.0_75)
  • remove the older Java version
  • run jython
  • run JAVA_HOME="$( /usr/libexec/java_home -v 1.7 )" jython

Expected

Both jython and JAVA_HOME="$( /usr/libexec/java_home -v 1.7 )" jython should work.

Actual

Both fail, complaining that (e.g.) /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/bin/java doesn't exist.

Additional Detail

An inspection of cat $( which jython ) reveals:

...
# This file was generated by the Jython installer
# Created on ...

JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/jre"
...

These lines are not present in the original source file. Setting JAVA_HOME in this manner:

  • a) may not be correct for very long; and
  • b) permanently overrides any external setting

This leaves the user with hand-editing $( which jython ) or reinstalling jython after every Java upgrade to get it to work, neither of which is ideal.

Change History (3)

comment:1 Changed 9 years ago by posita (Matt Bogosian)

Reproduction should have included as its first step:

  • Remove or set aside all currently installed versions of Java.

Also, running JAVA_HOME="$( /usr/libexec/java_home -v 1.7 )" jython only makes sense on systems where /usr/libexec/java_home is installed. I forget when Apple started doing this, but I think it was around Lion. The point is that given the current port, one cannot override where jython looks for Java via the JAVA_HOME environment variable, since the execution script overrides it with whatever it found at the time it was installed.

Apologies for any confusion.

Last edited 9 years ago by posita (Matt Bogosian) (previous) (diff)

comment:2 Changed 8 years ago by amake (Aaron Madlon-Kay)

This issue should be moot with Jython 2.7.0 as the wrapper script has changed to not hard-code JAVA_HOME.

comment:3 Changed 8 years ago by neverpanic (Clemens Lang)

Resolution: fixed
Status: newclosed

Thanks for checking, I'll close this then. It can be re-opened if this still occurs.

Note: See TracTickets for help on using tickets.