[MacPorts] #61445: Java version not detected on macOS Big Sur 11.0.1

MacPorts noreply at macports.org
Tue Nov 17 03:00:14 UTC 2020


#61445: Java version not detected on macOS Big Sur 11.0.1
---------------------+--------------------
  Reporter:  breun   |      Owner:  (none)
      Type:  defect  |     Status:  new
  Priority:  Normal  |  Milestone:
 Component:  ports   |    Version:
Resolution:          |   Keywords:
      Port:          |
---------------------+--------------------

Comment (by JBYoshi):

 On my system, I also get an error when running the command with `sudo`.
 However, manually setting the `$JAVA_HOME` environment variable to a valid
 installation will cause it to succeed:

 {{{
 jbyoshi at Yoshi ~ % sudo /usr/libexec/java_home -f -v 1.8+
 The operation couldn’t be completed. Unable to locate a Java Runtime that
 supports (null).
 Please visit http://www.java.com for information on installing Java.

 jbyoshi at Yoshi ~ % sudo
 JAVA_HOME=/Library/Java/JavaVirtualMachines/openjdk8/Contents/Home
 /usr/libexec/java_home -f -v 1.8+
 /Library/Java/JavaVirtualMachines/openjdk8/Contents/Home
 }}}

 In addition, unsetting the environment variable on a non-`sudo`
 environment reproduces the error:

 {{{
 jbyoshi at Yoshi ~ % unset JAVA_HOME
 jbyoshi at Yoshi ~ % /usr/libexec/java_home -f -v 1.8+
 The operation couldn’t be completed. Unable to locate a Java Runtime that
 supports (null).
 Please visit http://www.java.com for information on installing Java.

 }}}

 Strangely, the command always outputs the value provided for `$JAVA_HOME`
 when it's provided, even if the versions aren't compatible.

 {{{
 jbyoshi at Yoshi ~ % sudo
 JAVA_HOME=/Library/Java/JavaVirtualMachines/openjdk8/Contents/Home
 /usr/libexec/java_home -f -v 15+
 /Library/Java/JavaVirtualMachines/openjdk8/Contents/Home
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/61445#comment:11>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list