Skip to content

Instantly share code, notes, and snippets.

@pborissow
Last active April 13, 2024 12:54
Show Gist options
  • Save pborissow/1ce6f998301e413c5f09c4c7e1367b70 to your computer and use it in GitHub Desktop.
Save pborissow/1ce6f998301e413c5f09c4c7e1367b70 to your computer and use it in GitHub Desktop.
Netbeans

Netbeans Config

I've been using Netbeans for longer than I care to admit. I use it almost everyday for Java and JavaScript development. Here are some small tweaks I use to make Netbeans a little easier to use.

Set Main Project

When I first started using Netbeans, there was an option to select a project as a "Main Project". Visually, the main project is highlighted in bold in the Projects tree. When you have a main project selected, the build buttons in the main toolbar will apply to the selected project.

Newer versions of Netbeans don't have a "Set as Main Project" menu option when you right click on a project in the Projects tree.

To re-enable this feature, simply go to Run -> Set Main Project -> Select a project

Disable Inline Hints

Newer versions of Netbeans have inline hints enabled by default, which I find really annoying.

To disable inline hints, simply go to View -> Show Inline Hints

Remove Whitespaces

Personally, I don't like having whitespaces at the end of a line of code or empty lines of code with whitespaces. It really makes a mess when reviewing commits in git.

To trim whitespaces on save, go to Tools -> Options -> Editor -> On Save

  1. Select Language (or All Languages)
  2. Remove Trailing Whitespace select All Lines

image

Vertical Tabs

Personally, I usually end up with a lot of tabs open when I'm coding. Switching between tabs can be a pain when the tabs overflow. Instead you can render the tabs horizontally.

Tools -> Options -> Appearance -> Tab Placement -> Right

image

Clipboard Hack

If you're on Windows you may run into an issue with the clipboard in newer versions of Netbeans. There are multiple tickets for this issue but as of this post, there is no out-of-the-box fix. However, there is a workaround that works for me.

In the Netbeans installation folder look for a file called netbeans.conf. In there, there is a setting called netbeans_default_options. I recommend adding -J-Dnetbeans.slow.system.clipboard.hack=false to the list of args like this:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment