2

When running as a normal user, if you click on Netbeans->Preferences the window will open, shake, flash, freeze, and not let you do anything. The same thing happens with the Tools->Plugins. Running as super user it works perfectly. I have cleaned up all NetBeans related files. You can see it in action here.

It's useless as it is.

Dan M
  • 4,340
  • 8
  • 20

3 Answers3

1

Ive found a partial workaround for this.

You need to setup the OS not to open new documents as new tab.

Go to the Apple Menu, select System Preferences > General. In the Prefer tabs when opening documents option, select "never".

Then restart Netbeans and try to open Netbeans preferences.

Dusan.czh
  • 669
  • 8
  • 15
0

If you don't want a system-wide change, you can set the following setting. It should affect only applications running on JDK, run this in terminal:

defaults write net.java.openjdk.cmd "AppleWindowTabbingMode" never

It turns out that is a problem related to the AppleWindowTabbingMode settings. I was using "always", since I want that apps like Finder and other use new tabs rather than new windows.

This settings worked fine with NetBeans since Catalina. So I reset the behavior to "never" only for NetBeans, with the follow command

defaults write net.java.openjdk.cmd "AppleWindowTabbingMode" never

With this setting NetBeans works finally fine!

Sources: apparently, it's a bug, please see here and corresponding JDK bug.

Also, it's not a problem with NetBeans only. It affects AndroidStudio also see here for example:

Dmitry.M
  • 2,833
  • 1
  • 17
  • 30
  • Thanks, but no, it does not work. Now, Netbeans does not even open. It flashes and disappears. I will look into the logs; may be easier to diagnose now :) – Dan M Jan 18 '21 at 18:08
  • @JamesMead, it looks strange. Can you update the question and provide the version of JDK and the version of macOS. Also, can you try this command `defaults write net.java.openjdk.cmd "AppleWindowTabbingMode" manual` instead of `never` – Dmitry.M Jan 20 '21 at 10:56
  • Where does the "net.java.openjdk.cmd" part come from? is that a bundle identifier? And how would you go about finding it? – iCediCe Apr 26 '21 at 14:38
  • @iCediCe, i suppose it depends on the java itself, see [here](https://issues.apache.org/jira/browse/NETBEANS-5037?focusedCommentId=17300639&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17300639) – Dmitry.M Apr 26 '21 at 16:33
0

If you choose to run it as root, here's what I use:

#!/bin/bash
APP=/Applications/NetBeans/Apache\ NetBeans\ 12.2.app/Contents/MacOS/netbeans
COMPLAINT="Netbeans must run as %U because of bugs in the UI implementation :{"
PROMPT=$(echo -e "${COMPLAINT}\nPlease enter your login password for privilege escalation:")
sudo -p "${PROMPT}" -b -s "${APP}"

This lets me limp by with a recent JDK (15.0.2) which placates the corresponding NetBeans (12.2, as you can see from the code). The -b option tells sudo to run the app in the background, which in this case means simply that the Terminal in which you ran this script will not be polluted with JDK whinging about "illegal reflective access".

Scott Marks
  • 614
  • 8
  • 17