Re: Apache NetBeans 12.2-rc2 is Available for Testing!
There is currently no point in running java_home at all on Big Sur. It just returns what is already in the JAVA_HOME environment variable, or nothing. It might be best to simply check if the OS is Big Sur and skip running java_home. And complain to Apple that they’ve broken things. Scott > On Nov 17, 2020, at 9:33 AM, Christian Oyarzun wrote: > > > I installed Big Sur on a VM with JDK 8, 11, and 15 to test java_home. > > % /usr/libexec/java_home -V > Matching Java Virtual Machines (3): > 15.0.1 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 15" > /Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home > 11.0.9 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 11" > /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home > 1.8.0_275 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 8" > /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home > /Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home > > > If you have the environment variable JAVA_HOME set, java_home will return the > value of JAVA_HOME regardless of the arguments provided to java_home. > > % export > JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home > % /usr/libexec/java_home -v 1.8+ --failfast > > /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home > % > > > If JAVA_HOME is set to an empty string then an empty string is returned from > java_home. > > % export JAVA_HOME= > % /usr/libexec/java_home -v 1.8+ --failfast > % > > If JAVA_HOME is not set and you use a '+' in the '-v' and also have > '--failfast' it will not find a JDK. > > % unset JAVA_HOME > % /usr/libexec/java_home -v 1.8+ --failfast > 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. > > The '-v' with a '+' works without '--failfast' but also returns the same as > not using '-v' > > % unset JAVA_HOME > % /usr/libexec/java_home -v 1.8+ > /Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home > % /usr/libexec/java_home > /Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home > % > > > > Given this information, I would say nbexec should be changed as follows. > > % git diff > diff --git a/platform/o.n.bootstrap/launcher/unix/nbexec > b/platform/o.n.bootstrap/launcher/unix/nbexec > index ca7d16b13d..7be6a2f136 100644 > --- a/platform/o.n.bootstrap/launcher/unix/nbexec > +++ b/platform/o.n.bootstrap/launcher/unix/nbexec > @@ -140,10 +140,13 @@ if [ -z "$jdkhome" ] ; then > # try to find JDK > case "`uname`" in > Darwin*) > +# check if JAVA_HOME is empty string since java_home will return > the value of JAVA_HOME > +if [ -z "$JAVA_HOME" ]; then > +unset JAVA_HOME > +fi > # read Java Preferences > if [ -x "/usr/libexec/java_home" ]; then > -jdkhome=`/usr/libexec/java_home --version 1.8.0+ --failfast` > - > +jdkhome=`/usr/libexec/java_home --version 1.8+` > # JDK1.8 as a fallback > elif [ -f > "/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/java" ] ; > then > > jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home" > > > > --Christian > >> On Mon, Nov 16, 2020 at 5:02 PM Scott Palmer wrote: >> Wouldn’t matter, java_home doesn’t work at all, at least not in any >> reasonable way, on Big Sur. Regardless of the arguments. At least I can’t >> get it to do anything useful on my install of Big Sur. >> >> Scott >> On Nov 16, 2020, at 10:53 AM, Christian Oyarzun wrote: >>> >>> I believe part of the problem is in nbexec. While we fixed the installer to >>> remove /usr/libexec/java_home argument changes in Big Sur, we missed it in >>> nbexec. >>> >>> https://github.com/apache/netbeans/commit/e9143f9d2057fe66e0bffd5db955cf228d364346 >>> >>> % git grep java_home >>> contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/WLPluginProperties.java: >>> public static final String BEA_JAVA_HOME="bea_java_home"; // >>> NOI18N >>> contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/WLPluginProperties.java: >>> public static final String SUN_JAVA_HOME="sun_java_home"; // >>> NOI18N >>> contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/WLPluginProperties.java: >>> public static final String JAVA_HOME ="java_home"; // >>> NOI18N >>> nbbuild/installer/mac/newbuild/commonfiles/get_current_jdk.sh:if [ -x >>> "/usr/libexec/java_home" ]; then >>> nbbuild/installer/mac/newbuild/commonfiles/get_current_jdk.sh: >>> jdkhome=`/usr/libexec/java_home` >>>
Re: Apache NetBeans 12.2-rc2 is Available for Testing!
I installed Big Sur on a VM with JDK 8, 11, and 15 to test java_home. % /usr/libexec/java_home -V Matching Java Virtual Machines (3): 15.0.1 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 15" /Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home 11.0.9 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 11" /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home 1.8.0_275 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 8" /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home /Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home If you have the environment variable JAVA_HOME set, java_home will return the value of JAVA_HOME regardless of the arguments provided to java_home. % export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home % /usr/libexec/java_home -v 1.8+ --failfast /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home % If JAVA_HOME is set to an empty string then an empty string is returned from java_home. % export JAVA_HOME= % /usr/libexec/java_home -v 1.8+ --failfast % If JAVA_HOME is not set and you use a '+' in the '-v' and also have '--failfast' it will not find a JDK. % unset JAVA_HOME % /usr/libexec/java_home -v 1.8+ --failfast 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. The '-v' with a '+' works without '--failfast' but also returns the same as not using '-v' % unset JAVA_HOME % /usr/libexec/java_home -v 1.8+ /Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home % /usr/libexec/java_home /Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home % Given this information, I would say nbexec should be changed as follows. % git diff diff --git a/platform/o.n.bootstrap/launcher/unix/nbexec b/platform/o.n.bootstrap/launcher/unix/nbexec index ca7d16b13d..7be6a2f136 100644 --- a/platform/o.n.bootstrap/launcher/unix/nbexec +++ b/platform/o.n.bootstrap/launcher/unix/nbexec @@ -140,10 +140,13 @@ if [ -z "$jdkhome" ] ; then # try to find JDK case "`uname`" in Darwin*) +# check if JAVA_HOME is empty string since java_home will return the value of JAVA_HOME +if [ -z "$JAVA_HOME" ]; then +unset JAVA_HOME +fi # read Java Preferences if [ -x "/usr/libexec/java_home" ]; then -jdkhome=`/usr/libexec/java_home --version 1.8.0+ --failfast` - +jdkhome=`/usr/libexec/java_home --version 1.8+` # JDK1.8 as a fallback elif [ -f "/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/java" ] ; then jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home" --Christian On Mon, Nov 16, 2020 at 5:02 PM Scott Palmer wrote: > Wouldn’t matter, java_home doesn’t work at all, at least not in any > reasonable way, on Big Sur. Regardless of the arguments. At least I can’t > get it to do anything useful on my install of Big Sur. > > Scott > > On Nov 16, 2020, at 10:53 AM, Christian Oyarzun wrote: > > > I believe part of the problem is in nbexec. While we fixed the installer > to remove /usr/libexec/java_home argument changes in Big Sur, we missed it > in nbexec. > > > https://github.com/apache/netbeans/commit/e9143f9d2057fe66e0bffd5db955cf228d364346 > > % git grep java_home > contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/WLPluginProperties.java: >public static final String BEA_JAVA_HOME="bea_java_home"; // > NOI18N > contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/WLPluginProperties.java: >public static final String SUN_JAVA_HOME="sun_java_home"; // > NOI18N > contrib/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/WLPluginProperties.java: >public static final String JAVA_HOME ="java_home"; // > NOI18N > nbbuild/installer/mac/newbuild/commonfiles/get_current_jdk.sh:if [ -x > "/usr/libexec/java_home" ]; then > nbbuild/installer/mac/newbuild/commonfiles/get_current_jdk.sh: > jdkhome=`/usr/libexec/java_home` > > nbbuild/installer/mac/newbuild/commonfiles/postinstall/postinstall:DEFAULT_JDK_HOME=`/usr/libexec/java_home` > nbbuild/installer/mac/newbuild/commonfiles/unpack200_to_dir.sh:javapath=`/usr/libexec/java_home > --version 1.8` > nbbuild/installer/mac/newbuild/dmg/distribution-nbide.dist: > if(system.files.fileExistsAtPath('/usr/libexec/java_home')) { > nbbuild/installer/mac/newbuild/dmg/distribution-nbide.dist: var > res = system.run("/usr/libexec/java_home", "--failfast"); > nbbuild/installer/mac/newbuild/dmg/distribution.dist: > if(system.files.fileExistsAtPath('/usr/libexec/java_home')) { > nbbuild/installer/mac/newbuild/dmg/distribution.dist: var res = > system.run("/usr/libexec/java_home", "--failfast"); >