Using NetBeans/Linux under Windows/X11

Martin Zahn, Akadia AG, 17.02.2007
 

Overview

Java Software Development with NetBeans/Windows under Windows may be not the right choice, if your Target Platform is Linux or Solaris. Debugging OS specific Code can be painful or completely impossible. However there is an Alternative: NetBeans/Linux, running on the Linux Server, but the Output displayed on a Microsoft PC using an X11 Display Server (e.g. Cygwin/X). There are some Points to concern, until everything runs fine:

  • How to set the correct Keyboard in the X11-Server (e.g. Swiss German Layout).
     
  • Which Window Manager to use, an external one (e.g. KWin, mwm, twm) or the local Windows Manager or the even a local Cygwin/X Window Manager.

After some painful hours, we found the right combination of each part, and now everything runs fine. You can work in your normal Environment (Windows), but using and displaying resources (KWin, NetBeans) from the Linux Server. And one thing more - everything is free and there are NO costs.

Setup Windows Workstation / X11-Server

Download Cygwin/X, which is a port of the X Window System to the Microsoft Windows family of operating systems.

Cygwin/X consists of an X Server, X libraries, and nearly all of the standard X clients, such as xterm, xhost, xdpyinfo, xclock, and xeyes. Cygwin/X, as the name implies, uses the Cygwin project which provides a UNIX-like API to Xlib and X clients, thereby minimizing the amount of porting required.

Starting Cygwin/X and local XTerm

There are several methods of starting the Cygwin/X Server with a startup script that optionally starts initial clients and loads keyboard modifier maps. Here is our configuration which starts ONLY the X11-Server with a Swiss German Keyboard Support.

The Startup Script can be found under:

 ...\Cygwin\usr\X11R6\bin\startxwin.bat

REM Start X11-Server with Swiss German Keyboard Layout
%RUN% XWin -rootless -clipboard -silent-dup-error -xkblayout ch

REM Startup an xterm, using bash as the shell. Within the
REM .bash_profile allow any Host to display Output on this
REM  X11-Server.
%RUN% xterm -e /usr/bin/bash -l

Do NOT start a local Window Manager!

Allow any X11-Host to display Output on Cygwin/X

This is done in .bash_profile in the Home Directory of the Windows Workstation (e.g. C:\Users\Zahn\.bash_profile).

xhost + 1>/dev/null 2>&1

Setup / Start X-Clients from Linux Server

The hard Part is now done - just display the Output from the Linux/X11 Machine to the Cygwin/X Server using the Environment Variable DISPLAY. Do NOT forget to start the Window Manger, we recommend KWin.

$ DISPLAY=192.168.138.11:0.0
$ export DISPLAY

$ kwin --replace &
$ netbeans &

Thats it!