Proxy Configuration and DNS Routing
The "SOCKS" configuration in the NetBeans Options menu does not automatically trigger the socksProxyHost and socksProxyPort JVM system properties. The UI settings primarily configure the IDE's internal HTTP client used for specific tasks like plugin updates, whereas JVM properties control the underlying network stack for the entire process.
DNS Resolution Behavior
To ensure DNS resolution occurs on the proxy side rather than the local host, you do not use -Dsun.net.spi.nameservice.nameservers. That property specifies alternative DNS servers for the local name service; it does not route requests through a SOCKS proxy.
Remote DNS resolution is handled by the JDK's SOCKS implementation. For the JVM to delegate hostname resolution to the proxy, the proxy must support SOCKS5 or SOCKS4a, and the JVM must be explicitly told to use that proxy via system properties in netbeans.conf.
Required Configuration Steps
To force the IDE and its embedded processes to route both traffic and DNS through a SOCKS proxy, add the following flags to the netbeans_default_options string in your netbeans.conf file:
-J-DsocksProxyHost=your.proxy.host
-J-DsocksProxyPort=1080
Note: The -J prefix is required in netbeans.conf to ensure the argument is passed directly to the JVM.
Verification and Diagnostics
Because UI settings and JVM properties operate independently, you may encounter inconsistent behavior where plugin updates work (via UI) but Maven dependencies fail (via JVM). To verify where resolution is happening, launch NetBeans from a terminal with the following debug flag:
-J-Djava.net.debug=proxy,dns
Observe the console output during a connection attempt. If you see local DNS lookups preceding the SOCKS handshake, the JVM is still attempting local resolution.
Assumptions and Constraints
- JDK Version: This assumes a Java 7+ runtime, as earlier versions had limited SOCKS4a/5 remote DNS support.
- Proxy Support: This assumes your corporate SOCKS proxy supports remote DNS (SOCKS5 UDP Associate or SOCKS4a). If the proxy only supports TCP CONNECT, the JDK will continue to resolve DNS locally.
- Authentication: The standard JDK SOCKS implementation does not support proxy authentication via system properties. If your proxy requires a username/password, you will need a local wrapper (like Cntlm) or an SSH tunnel.
Missing Diagnostic: Are you using an embedded Maven/Gradle instance or an external installation? External installations ignore netbeans.conf and require their own settings.xml or gradle.properties configuration.