netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Windows Terminal Support using WSL

Open matthiasblaesing opened this issue 1 month ago • 3 comments

Historically NetBeans relied on cygwin or MSYS to provide a shell on windows.

With WSL (the windows subsystem for linux) an alternative was established, that runs a full linux kernel inside a windows session, providing a full linux userland, including a shell.

The benefit of WSL is, that it is built-in technology and thus has a lower threshold for installation than cygwin. The drawback is, that initial startup of wsl is slower than opening a cygwin/MSYS bash.

The change here tries to check that

  • WSL2 is available and
  • that a distribution is installed in WSL2

If this is the case NetBeans defaults to WSL.

Users can override the automatic detection by setting the org.netbeans.modules.nativeexecution.api.util.WindowsSupport.shellProvider system property to CYGWIN, MSYS or WSL.

Here is a screenshot with a testsystem with WSL and Cygwin both present, but WSL has no distribution installed:

grafik

The same system after installing Ubuntu and restarting NetBeans:

grafik

Closes: #3959

matthiasblaesing avatar Nov 27 '25 21:11 matthiasblaesing

work nice !! Thanks for this feature.

ebarboni avatar Nov 28 '25 12:11 ebarboni

Testing today showed that the WSL emulation is incomplete. Searching showed that the problem is known: https://github.com/microsoft/WSL/issues/10311 (WSL doesn't automatically mount drive letters added by subst command)). You can't execute wsl commands on drives bound using subst and for me it also failed for network drives.

matthiasblaesing avatar Dec 05 '25 17:12 matthiasblaesing

Testing today showed that the WSL emulation is incomplete. Searching showed that the problem is known: microsoft/WSL#10311 (WSL doesn't automatically mount drive letters added by subst command)). You can't execute wsl commands on drives bound using subst and for me it also failed for network drives.

The fail comes from the netbeans pty tool. The pty tool is invoked with the target directory, but "special" drives are not mapped. My tests indicate, that wsl:

  • supports regular drives
  • supports drives mapped using virtiofs
  • does not support mapped network drives
  • does not support drives mapped by subst

matthiasblaesing avatar Dec 13 '25 09:12 matthiasblaesing