1. Introduction:

NetBeans is powerful, user friendly and rich features IDE. One of good features is C/C++ remote development where you can use local computer to write your code and compilation and program execution are in a remote Linux server.  Using VPN, your local computer and remote Linux server can even be geographical securely separated away. This guide describes NetBeans 8.2 and  the C/C++ remote development feature to develop Linux programs in Windows platform.  Although this guide is written for Windows platform, it is same procedures for local computers being MacOS and typical desktop Linux platforms.

The magic behind remote development is the SSH protocol both to execute program remotely and share source code between local and remote server. Sharing source code  is via SSHFS (SSH Filesystem).  SSHFS  is a filesystem client to mount and interact with directories and files located on a remote server over a normal ssh connection. The client interacts with the remote file system via the SSH File Transfer Protocol (SFTP), a network protocol providing file access, file transfer, and file management functionality. SFTP was designed as an extension of the Secure Shell protocol (SSH) version 2.0. 

Using SSH, you can also access remote Linux server with graphical user interface, check out the article Lite Graphical User Interface to Access Remote Linux Server Over SSH for details. If you're going to develop graphical user application remotely, you will need this solution as well.

To begin and follow the steps we're going to describe. You must have NetBeans 8.2 with C/C++ plugin installed in the local Windows computer and access right to the remote Linux server.  If you don't have access right on any remote Linux servers,  we compile a VirtualBox Linux virtual machine which running Ubuntu 16.04.  You can download it [here].  You run it in the same network of  you local Windows desktop computer.  It can act as the remote Linux server.  After downloaded, runs VirtualBox and selects the File menu and choose Import Appliance to integrate it to your VirtualBox run-time. As it is for learning purpose, you should use it strictly in private network and without given access from the Internet.  

Step 2 to 4 are initial setup procedures, you only need to do one time. Step 5 is the programming environment you will engage most.

2. Mapping Remote Home Directory as the Network Drive in Windows

To edit , create and compile your Linux program in Windows, you will need to share the your account home directory in the Linux server to local Windows computer. To do that we use SSHFS as mentioned previously.  You can follow this SSHFS Setup Guide to complete this task. For materials we are going to describe we assume your home directory is  "/home/user" in the remote Linux server and change it to your real one on the point requiring this information. It is mapped to local drive letter "Z:". If you're successfully done SSHFS step, on the Z: network drive creates a folder named "NetBeansProjects" as following figure.


3. Setting Up Remote Host SSH Connection:

 In addition to have network drive mapped for source code sharing, one step is to establish SSH connection between your local windows and remote Linux server. It is very easy to do that.  Selecting the Services tab, you will see a service tree with different service nodes.  Clicking right mouse button on the C/C++Build Hosts node and selects "Add New Host..." will guide you to setup ssh connection.  If you successfully make the connection, the little computer icon will turn to green color.


4. Specifying Home Directory Mapping


5. Writing Linux Programs