March 2014 [Revision number: V8.0-1]
This document describes how to use remote development features of the NetBeans IDE with C/C++/Fortran projects.
To follow this tutorial, you need the following software.
This tutorial demonstrates how to use remote development of C/C++ projects.
Have you ever wanted to develop a Solaris or Linux application from your laptop running Windows 7 or Mac OS X? To test your application on different operating systems without even leaving the IDE? Or just to compile your large applications on a fast multicore server rather than on your regular workstation. The answer to all these needs is the remote development feature in NetBeans IDE.
When you do remote development, you run the NetBeans IDE on your client system and you can create projects, edit files, and use code assistance features the same way as you do for local projects. But when you build, run, or debug your project, the process runs on the remote Solaris or Linux server with output and input transferred to the client system. Ideally, you shouldn’t see any difference in workflow between doing local and remote development once you’ve set up the remote build host.
The IDE supports different modes of remote development, which are described in C/C++ Remote Development Modes. You can determine how you want to develop on the remote host.
Requirements for Remote Development
The elements that must be in place to enable the use of a remote host for running your tools are:
Both your client system and your remote server have to know about your source files. The source files can reside on a shared network path, or can be copied securely by the IDE from the local system to the remote system. See Setting Up the System for more details about how to set up shared folders for different systems.
All data transfer between client and server is done through the Secure Shell (SSH) protocol. SSH is a common protocol for secure communications between two networked devices. Your server must have the SSH server installed, and SSH connection between the client system and the server must be allowed.
The IDE must be able to find a supported tool collection on the remote host: GNU Compiler Collection or Sun Studio or Oracle Solaris Studio. The tools executables should be on the path of the user account used to connect to the remote host, so the IDE can easily locate the tools. This is especially true if the tools are installed in a non-default location.
For correct operation of editor features like code completion and semantic highlighting, the Classes window, and others, your project has to be used in the correct environment, which means system includes, macro definitions, platform, etc. All of this information is gathered from the remote server and stored locally on your client system, so that when you edit locally the code assistance will work even when the project is set up to use a remote build host.
Setting Up the System
Your remote Linux or Solaris server must allow communication through the SSH protocol from the client where you are running the IDE. If you want to use file sharing instead of allowing the IDE to copy files to the remote server, the file sharing must be set up in the network for both systems.
The SSH server is usually included in Linux and Solaris operating systems, and is run by default in most cases. If not, you can find information about installing and managing SSH at http://en.wikipedia.org/wiki/Secure_Shell
The IDE provides its own ssh client, so you do not need to install the ssh client on your local machine.
An SSH connection must be allowed between your client and server systems, which usually means port 22 must be open on the server. You may need root access or the help of your system administrator if port 22 is disabled.
SSH must be enabled between the systems even if you are not using the Automatic Copying or SFTP option to transfer the projects files to the remote server.
If you do not already have file sharing set up between your Windows system and a Unix remote host for other uses, it is much simpler to use Automatic Copying or SFTP instead of file sharing for small to medium projects. If you are working on a large project with thousands of files that participate in the build, sharing makes more sense because copying would take a long time.
For Windows to UNIX® configuration there are two major ways of sharing sources:
Organizing Sources Using Samba or SMB
A Samba server (open source version of SMB) allows a Windows user to map shared NFS folders as Windows network drives. The Samba package, or its equivalent SMB or CIFS, is included in most distributions of Linux and Solaris operating systems. If Samba is not included in your distribution, you can download it from www.samba.org.
If you have privileged access on your server, you can set up Samba yourself following the instructions at the following links. Otherwise you have to contact your system administrator.
After starting Samba you can map your UNIX server’s folders the same way as Windows folders.
Windows Services For UNIX (SFU)
Another option is Windows Services For UNIX, a set of utilities provided by Microsoft to access NFS filesystems from Windows.
The SFU package is not available for Windows Vista or Windows 7 users. Windows Vista and Windows 7 Enterprise and Ultimate Editions include the Services for Unix components, renamed to the Subsystem for UNIX-based applications (SUA), and Client for NFS v3. For more information, see http://en.wikipedia.org/wiki/Microsoft_Windows_Services_for_UNIX
Mac OS X configuration
Mac OS X includes support for connecting to Samba servers. Mac OS X can also mount NFS shares from a server.
You can use Finder > Go > Connect to Server and enter a server address.
To connect to SMB/CIFS (Windows) servers and shared folders, enter the server address in one of these forms:
You are prompted to enter the username and password for the shared folder. See How to Connect to Windows File Sharing (SMB) in the Apple knowledge base for more information.
To connect to an NFS server, type the server name and path to the NFS shared folder in one of these forms:
For more information, see Using the Finder to Mount NFS Exports in the Apple knowledge base.
You are not prompted for your username and password, but authorization is checked against your Mac UID. The UID is a unique integer assigned to your username in Unix-like operating systems such as Mac OS X, Solaris, and Linux. To use NFS, the Mac UID must be the same as the UID of your account on the server.
For file sharing between Solaris or Linux systems, you do not need any special setup. You just need to share a folder from one of the systems or you can use your home directory if it is mounted on a network file server and accessible from both systems.
When using the shared sources model, you may need to map the location of the sources on the local host, to the path used on the remote host to get to the sources.
For example, consider this configuration:
In this case from the server point of view your source files are located in the /export/pub/myproject. But from the client point of view the location of the source files is P:myproject. You need to let the IDE know that these paths are mapped:
You can edit the properties of the build host to set path mappings.
If you set up shared resources for source files before configuring the remote host in NetBeans IDE, the IDE will automatically find out the required path mappings for you in most cases.
Setting Up the IDE
In the following example, the client host is a workstation running Windows Vista. The remote host named edgard is a server running the Oracle Solaris operating system.
If no tool collection is listed
Try the following tasks if you do not see any tool collections under the remote host node.
When you have a tool collection listed, you are done with creating your new remote build host.
In the next section, you can try simple remote development.
Building a Local Project on a Remote Host
There is almost no difference in workflow once you set up a remote host. You can use all editor features, build, run, test, and debug as you are used to doing locally.
You can start a secure shell terminal session from within the IDE to connect to the remote system or the local system. This feature is especially convenient on Windows platforms, which do not support SSH natively.
For More Information
See the following locations for more information: