Trying to run Netbeans IDE on a HiDPI screen in Linux right now is a bit of a pain in the arse. There's several reasons for this:
- Java does not support HiDPI scaling prior to version 9.
- The current production release of Netbeans, 8.2, does not run on Java 9.
- Netbeans' ownership is in the process of being transferred from Oracle to the Apache Software Foundation. They are doing a ton of due diligence and auditing, as you might imagine, so the release of Netbeans 9 (which does support Java 9 and 10) has been delayed significantly.
- No version of Netbeans, including Netbeans 9, will automatically scale to a HiDPI screen on Linux.
However, if you enjoy using Netbeans and want a version that currently works on Linux, I have figured out the best current workaround. Firstly, go get yourself a copy of the Netbeans nightly from the link below. While these are nightly builds, NB9 has been hovering near release for quite some time now, so they're pretty damn stable. You may lose support for some of your plugins, though my important ones seem to work OK.
Unzip the archive somewhere safe, then move it to your /usr/local directory like so:
sudo mv netbeans /usr/local/netbeans-9-incubating
The real trick comes in here, with the
GDK_SCALE environment variable. This variable, part of the GTK runtime, tells applications that use it to scale their UIs accordingly. Given that HiDPI support in Linux can currently be a hodge-podge, setting this globally is likely a bad idea, so we'll create a two-line wrapper script for Netbeans that sets the variable before starting the IDE. Create the file
/usr/local/netbeans-9-incubating/bin/netbeans-scaled (you'll need to use sudo, remember) and give it the following content:
GDK_SCALE only takes integers, so if your ideal scaling factor is 1.5, 2.2, etc, you'll have to settle for the nearest appropriate whole integer. I set mine to 3 on some displays because I'm only ever getting older and blinder. Finally, don't forget to set the executable permission on your new script.
You're done! You can now optionally make a menu entry for your system (using KMenuEdit, Alacarte, etc) that points to this wrapper script, and you'll be able to start and run Netbeans as normal. I hope that helps some folks out.
Some more information on
GDK_SCALE and associated variables can be found at the following link: