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 <c...@oyarzun.net> 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 <swpal...@gmail.com> 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 <c...@oyarzun.net> 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");
>>> nbbuild/installer/mac/newbuild/pack200.sh:javaPath=`/usr/libexec/java_home 
>>> --version 1.8`
>>> nbi/engine/native/launcher/unix/src/launcher.sh:        if [ -x 
>>> "/usr/libexec/java_home" ]; then
>>> nbi/engine/native/launcher/unix/src/launcher.sh:            
>>> javaOnMacHome=`/usr/libexec/java_home --failfast`
>>> platform/o.n.bootstrap/launcher/unix/nbexec:            if [ -x 
>>> "/usr/libexec/java_home" ]; then
>>> platform/o.n.bootstrap/launcher/unix/nbexec:                
>>> jdkhome=`/usr/libexec/java_home --version 1.8.0+ --failfast`
>>> 
>>>  --Christian
>>> 
>>>> On Sat, Nov 14, 2020 at 4:45 PM Geertjan Wielenga 
>>>> <geertjan.wiele...@googlemail.com> wrote:
>>>> So far, the only problem I've been able to identify via interactions in a 
>>>> NetBeans issue re Big Sur is that it seems that during the installation of 
>>>> Big Sur, various permissions appear to be overwritten so that the NetBeans 
>>>> launcher can't launch NetBeans.
>>>> 
>>>> So, just check the permissions and, to verify further, use the command 
>>>> line with 'sudo' to run NetBeans, which, if it succeeds, tells you that 
>>>> your permissions are messed up.
>>>> 
>>>> Gj
>>>> 
>>>>> On Sat, Nov 14, 2020 at 10:43 PM Scott Palmer <swpal...@gmail.com> wrote:
>>>>> Does the NB installer try to find the JDK folder by calling 
>>>>> /usr/libexec/java_home ?  If so, the java_home tool is completely broken 
>>>>> under Big Sur and will not return a JDK folder unless a JAVA_HOME 
>>>>> environment variable is *already* set to a valid JDK, in which case the 
>>>>> java_home tool always returns the value $JAVA_HOME.  If JAVA_HOME isn't 
>>>>> already set, the java_home tool doesn't work at all.  You can get it to 
>>>>> list other JDKs installed if JAVA_HOME is already set to a valid home 
>>>>> folder for one of the JDKs.
>>>>> 
>>>>> I reported these issues to Apple during the Big Sur beta and the report 
>>>>> seemed to be reviewed by somebody that didn't have a clue what they were 
>>>>> doing and said java_home was working as designed!  I reported a couple 
>>>>> issues that remain unresolved.  Not sure if anyone has a contact at Apple 
>>>>> (the one email address I had bounced), but if you do maybe you can give 
>>>>> them a nudge.
>>>>> 
>>>>> Scott
>>>>> 
>>>>> 
>>>>>> On Fri, Nov 13, 2020 at 11:19 AM Christian Oyarzun <c...@oyarzun.net> 
>>>>>> wrote:
>>>>>> I think there are potentially two issues at play with MacOS.
>>>>>> 
>>>>>> 1. NETBEANS-5004 Netbeans not allowed to access personal files and folder
>>>>>> under macOS
>>>>>>     https://issues.apache.org/jira/browse/NETBEANS-5004
>>>>>>     This does not have to do with Big Sur, but rather if you use JDK 
>>>>>> 11.0.9
>>>>>> you can no longer access files from your Desktop or Documents folders.
>>>>>>     From looking at the comments in the issue, the problem seems to be 
>>>>>> that
>>>>>> NetBeans is launched with a shell script which is not signed.
>>>>>> 
>>>>>> 2. And an issue with dialogs in Big Sur.
>>>>>> http://mail-archives.apache.org/mod_mbox/netbeans-dev/202011.mbox/%3CDDBAC320-96AA-42AF-99D6-00F5AAA9566C%40jcmachado.net%3E
>>>>>>     Not sure if this is the same issue as it just says it does not work.
>>>>>> http://mail-archives.apache.org/mod_mbox/netbeans-dev/202011.mbox/%3C78454EE5-6CBB-44A2-950D-0E24C85BC89E%40icloud.com%3E
>>>>>> 
>>>>>> Not having Big Sur installed, I have not encountered #2. But I have seen
>>>>>> NETBEANS-5004 with Catalina and JDK 11.0.9 and the workaround is to run
>>>>>> NetBeans from the Terminal.
>>>>>> 
>>>>>> --Christian
>>>>>> 
>>>>>> On Fri, Nov 13, 2020 at 10:58 AM Laszlo Kishalmi 
>>>>>> <laszlo.kisha...@gmail.com>
>>>>>> wrote:
>>>>>> 
>>>>>> > Well,
>>>>>> >
>>>>>> > So far there is no open blocker issue reported against NetBeans.
>>>>>> > Supporting an OS which just released to the public would be nice, but 
>>>>>> > it
>>>>>> > wasn't really in the scope in the last 3 months.
>>>>>> >
>>>>>> > As far as I knew the situation, some people reported weird rendering
>>>>>> > issues, which could be the JDK, and lately that our Mac installer does
>>>>>> > not work on BugSur, which have the work around of using our zip
>>>>>> > distribution.
>>>>>> >
>>>>>> > These could be covered in the Release Notes. If we have real issues to
>>>>>> > act on, those could be fixed in 12.3 (must be reported first though)
>>>>>> >
>>>>>> > Again, we are releasing the Source code. Though convenience binaries 
>>>>>> > are
>>>>>> > important, we cannot be expected to support every new and shiny right
>>>>>> > after it is released.
>>>>>> >
>>>>>> > So we are still on track with the 15th of November cut of 12.2 release.
>>>>>> >
>>>>>> >
>>>>>> > On 11/13/20 12:33 AM, Geertjan Wielenga wrote:
>>>>>> > >
>>>>>> > > I think we need to look at these new Mac related issues and shouldn’t
>>>>>> > > release 12.2 until we have some response or plan around that.
>>>>>> > >
>>>>>> > > Gj
>>>>>> > >
>>>>>> > > On Fri, 13 Nov 2020 at 08:51, Laszlo Kishalmi
>>>>>> > > <laszlo.kisha...@gmail.com <mailto:laszlo.kisha...@gmail.com>> wrote:
>>>>>> > >
>>>>>> > >     Dear Apache NetBeans community,
>>>>>> > >
>>>>>> > >     The second, and hopefully final release candidate of Apache 
>>>>>> > > NetBeans
>>>>>> > >     12.2 is available.
>>>>>> > >
>>>>>> > >     This one is fixing one blocker issue [NETBEANS-5007] No restart 
>>>>>> > > of
>>>>>> > >     language server after change of JDK home
>>>>>> > >
>>>>>> > >     as of: https://github.com/apache/netbeans/pull/2531
>>>>>> > >
>>>>>> > >     Technically this codechange only affects the upcoming VSCode
>>>>>> > >     Extension,
>>>>>> > >     so our target date for cutting the release is still 15th of 
>>>>>> > > November.
>>>>>> > >
>>>>>> > >
>>>>>> > >     **The following rules are applied to the PR-s :**
>>>>>> > >
>>>>>> > >     As this is a release candidate, if everything goes right the 
>>>>>> > > release
>>>>>> > >     build would be cut from the very same git commit as this one.
>>>>>> > >
>>>>>> > >     Only fixes for blocker issues are allowed this time! The rules 
>>>>>> > > are
>>>>>> > >     the
>>>>>> > >     following:
>>>>>> > >     - The blocker issue, if found has to be announced and discussed 
>>>>>> > > on
>>>>>> > >     the
>>>>>> > >     developer mailing list first. Please note that if you have 
>>>>>> > > concern
>>>>>> > >     about
>>>>>> > >     the the licensing of some files/component please raise it now as
>>>>>> > >     those
>>>>>> > >     are considered blocking.
>>>>>> > >     - If there would be an eventual need of fix, please:
>>>>>> > >     - Mark the milestone as: 12.2
>>>>>> > >     - Please add me (lkishalmi) as an additional reviewer
>>>>>> > >
>>>>>> > >     That would also indicate that we do another release candidate 
>>>>>> > > when
>>>>>> > >     the
>>>>>> > >     issue is fixed.
>>>>>> > >
>>>>>> > >     I've merged all the changes happened for NetBeans12.2-rc2 to the
>>>>>> > >     master
>>>>>> > >     as well:
>>>>>> > >     - If you feel the PR is ready for 12.3 then mark that milestone
>>>>>> > >     - Add the usual reviewers
>>>>>> > >     - API/SPI changes are fine
>>>>>> > >     - Structural changes are welcome if needed
>>>>>> > >
>>>>>> > >     If everything goes right the Next action would be the vote on the
>>>>>> > >     release from 15th of November!
>>>>>> > >
>>>>>> > >
>>>>>> > >     The NetBeans 12.2-rc2 artifacts are here:
>>>>>> > >
>>>>>> > https://ci-builds.apache.org/job/Netbeans/job/netbeans-TLP/job/netbeans/job/release122/17/artifact/dist
>>>>>> > >
>>>>>> > >
>>>>>> > >
>>>>>> > >     Link to the binary zip:
>>>>>> > >
>>>>>> > https://ci-builds.apache.org/job/Netbeans/job/netbeans-TLP/job/netbeans/job/release122/17/artifact/dist/netbeans/netbeans-12.2-rc2-bin.zip
>>>>>> > >
>>>>>> > >
>>>>>> > >     SHA512:
>>>>>> > >
>>>>>> >  
>>>>>> > 5b9f8194f997ce72c4f4a4cec2b32c6c0422cc5d1a3bc7a2862e813797998b7474a5f93979fb1bb8e3222b31fbe03260a452d116fdca65238c520cde01174891
>>>>>> > >
>>>>>> > >     The sources are here:
>>>>>> > >
>>>>>> > https://ci-builds.apache.org/job/Netbeans/job/netbeans-TLP/job/netbeans/job/release122/17/artifact/dist/netbeans/netbeans-12.2-rc2-source.zip
>>>>>> > >
>>>>>> > >
>>>>>> > >     SHA512:
>>>>>> > >
>>>>>> >  
>>>>>> > 9152c7ea1e87403ed4855ebbafbdcd431725bd1b685ad8dfeefb7c7418d1545a2eaf996e94df379516f22a6d3d41171c09571810df19e40a7d1cf5e5e578e269
>>>>>> > >
>>>>>> > >     Release schedule :
>>>>>> > >
>>>>>> > https://cwiki.apache.org/confluence/display/NETBEANS/Release+Schedule
>>>>>> > >
>>>>>> > >     Bug Priority Guidelines :
>>>>>> > >
>>>>>> > https://cwiki.apache.org/confluence/display/NETBEANS/Bug+Priority+Guidelines
>>>>>> > >
>>>>>> > >
>>>>>> > >
>>>>>> > >     Thank you for your contributions!
>>>>>> > >
>>>>>> > >     --
>>>>>> > >     Laszlo Kishalmi
>>>>>> > >     Release Manager of Apache NetBeans 12.2
>>>>>> > >
>>>>>> > >
>>>>>> > >     
>>>>>> > > ---------------------------------------------------------------------
>>>>>> > >     To unsubscribe, e-mail: netcat-unsubscr...@netbeans.apache.org
>>>>>> > >     <mailto:netcat-unsubscr...@netbeans.apache.org>
>>>>>> > >     For additional commands, e-mail: netcat-h...@netbeans.apache.org
>>>>>> > >     <mailto:netcat-h...@netbeans.apache.org>
>>>>>> > >
>>>>>> > >     For further information about the NetBeans mailing lists, visit:
>>>>>> > >     
>>>>>> > > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>>> > >
>>>>>> >

Reply via email to