Turn: Netbean remote development of good text 2--工欲善其事, its prerequisite series--netbeans remote development

Source: Internet
Author: User
Tags comparison table ultraedit netbeans

Transferred from: http://www.cnblogs.com/zuoca/archive/2012/07/09/Remote_Development_With_Netbeans_origin.html

Practical Difficulty: ★★☆☆☆

Practicality: ★★★★☆

Are you still using purely manual development?

Are you still using local development, FTP to remote host to compile the cumbersome way?

Are you still frustrated by the constant switching of the edit window, FTP window, and SSH window?

Are you still distressed by the vi,gdb of the command that is not able to skillfully use Linux?

Are you still worried about not being able to use the modern IDE?

......

I am also depressed about all of this as a Linux/C + + programmer like you. Always envy Java programmers have such a user-friendly IDE such as Eclipse,netbeans (embedded code templates, code formatting, auto-completion, code refactoring and other functions for programmers are effective to improve development efficiency of the necessary weapon). Although Visual Studio,borland Builder,code::block is also very convenient for C-+ + language development, Linux also has a good IDE, but when it comes to our "Local development, remote compilation, remote operation" of the development model, Everything has become less friendly. The IDE's own features are either incomplete or require cumbersome personalization to achieve similar results with a large number of plug-ins. We can't just write one for ourselves, like those Daniel. A majority of people do not have this skill, the second industry must have a solution for this kind of situation, we just need to find a suitable for their own good. Finally, in the constant search, I found such a can help us to "liberate hands, liberate productivity" of the ide-netbeans7.1. There are few online data on remote development, and most of them are not necessarily successful even if you follow the instructions. In this article I will introduce you to NetBeans's powerful and useful remote development capabilities through a complete example.

Test environment

Local Host

Remote host:

Operating system

XP Professional

Linux 2.6.9-42.el

Other software

JAVA-JDK 1.7.0_05

NetBeans 7.1

GCC 3.4.6

GDB 7.4

(Remote debugging must use gdb6.8+)

1 Status Analysis

Before we get started, let's take a look at how Linux C + + programmers work today.

Because the graphical development environment using the Linux side consumes a lot of resources, and in most cases we are not allowed to use such a development approach. Use VI Development and configure a variety of plug-ins, familiar with various commands. We're programmers, not memory chips, we hate to memorize weird commands. So most programmers use the development method is to edit the code locally, and then FTP to the remote host, the remote host to compile, Debug. When an error occurs, switch back to the local environment to modify the code, in FTP, compile, Debug. If the problem persists, repeat the above operation. If the program logic is complex, this process can continue until either the programmer crashes or the program crashes.

Most programmers currently use the two tools of UltraEdit and Sourceinsight, which are compared from several dimensions.

UltraEdit

Sourceinsight

Formatting

No

No

Code browsing

No

Perfect support

Refactoring

Not supported

Support

Auto-complete

Simple support

Perfect support

Code templates

No

No

Version control

Need to be implemented with custom external tools

Basic support

Remote development

Not supported

Not supported

Remote compilation

Not supported

Not supported

Remote debugging

Not supported

Not supported

As you can see, the features of these two editors are somewhat immature relative to an IDE. (They are not, of course, sold in the guise of the IDE, and it is somewhat unfair to make such evaluations.)

2 Comparison of schemes

I also tried several ides that claimed to support remote development before finalizing the recommendation for NetBeans. The following table compares these Ides to demonstrate that NetBeans I recommend to you is indeed the best choice for the present.

Remote Development Scenario Comparison table

Eclipse C + +

Netbeans C + +

Magicunix

Formatting

Support

Support

Support

Code browsing

Support

Perfect support

Support

Refactoring

Support

Perfect support

Not supported

Auto-complete

Support

Perfect support

Support

Code templates

Support

Support

Not supported

Version control

Support-(Testing a problem)

Perfect support

Support

Dependency Plugins

Rdt,ptp

No

No

Dependent services

Perl,java,ssh,rdt-server

Ssh

Ssh

Remote development

Support

Support

Support

Remote compilation

Support

Support

Support

Remote debugging

Support-(test problems)

Perfect support

Perfect support

Offline support

Not supported

Support

Not supported

Comprehensive evaluation

The eclipse framework-based remote development scenario is shared by IBM and HP, but the products that are developed are not very useful. There are too many dependencies and more existing bugs.

The remote solution based on NetBeans framework should be the most ideal solution, although there are many bugs, but as long as reasonable use, still can play its characteristics.

Developed by the Chinese toll software, recently stopped updating, the interface is similar to VC6, remote functionality than Eclipse, the only disadvantage is not support offline development.

I'll go over the remote development features of NetBeans in detail next.

3 Remote Development

(Note: For NetBeans itself is not introduced, interested in the words can see the introduction of the official website.) Basic operation due to space limitations also do not introduce, more use a few times naturally familiar with)

Installing NetBeans

    1. Go to Http://netbeans.org/NetBeans website to download NetBeans 7.1.2
    2. Installation (Specific process I'm sure I don't have to say more.)

Turn on the download function

    1. Desktop Right click on NetBeans shortcut, select Properties---Shortcut
    2. Add after the target column

-j-dcnd.remote.download.project.action=true

3. Determine

Let's start our long-distance development tour.

    1. Open NetBeans
    2. Create a project file

New project, files, toolbars

(Note: If you choose to base your existing source code and binary-based projects, post-add files will have upload bugs.) )

Fill in the basic information such as project name, generate host select localhost

Click Done to create a successful project

    1. Import existing source code or add source code

Project name right-click Add Existing Item from folder

(Note: The new folder does not automatically join the project, you need to close the project and reopen it.) It is recommended to use a pre-created source directory structure and then import one at a time, if you need to add a new folder in the middle, you can add it externally, and then right-click the project name---Delete, add again. )

    1. Add a remote host

Since it is remote development, you must configure the remote development environment so that the IDE can provide code completion, code analysis and other functions.

Project name right-click Settings remote build host management host

When you click Manage components, the Build Host Manager interface appears

Click the Add button and the new remote build host interface appears, filling in the host name (IP).

Click Next, change the login user name, authentication method Select password mode (if the remote side is SSH key mode, then select the SSH key file.)

Click Next to enter the user password

Click OK, NetBeans starts to search the remote host development environment automatically

(Note: If the path that is automatically searched does not match the actual path, or if you want to customize the execution path, you can do so after the remote host is created.) Select toolbars, tools, Options->c/c++à build tool, development host Select the host to configure, edit tool execution path, edit complete, OK)

Click Next and select Project file access as "System level file Sharing (NFS, samba, etc.)"

(Note: Access must be selected at the system level file share)

Click Done.

Click on the path mapper to establish the mapping relationship between the local source code and the remote host source code.

Local path fills in the path of the local source code, and the remote path fills in the directory where you want to store the source code.

This completes the remote host.

    1. Add header file path

In order to properly parse the containment relationship between source code and provide automatic completion of the code, configuring additional header file paths is an essential step.

Tools, options->c/c++-> Code Help

Click the Add button to join the common header file path, if there is a system unresolved macros can also be resolved by adding a macro definition.

(Note: If the custom header file path is too large, adding is too cumbersome to be implemented by changing the configuration file.) Because the operation is lengthy, we do not repeat it.)

Once the path has been added, click OK.

    1. End of project configuration.

After the project configuration is finished, we can do the normal source editing and create the work.

(Note: The project source code is the default encoding of UTF-8, if the source code format does not match, in the attempt to open sources will pop up "unable to use the encoding UTF-8 securely open the file ..." 's dialog box.

You need to modify the project default encoding at this time.

Concrete steps: Project Name right-click Properties, General

4 Remote Compilation

At the end of source editing, we need to compile the source code.

Project source code catalog Right-click Upload to ....

(Note: The upload process may indicate that the source code mapping path does not exist, follow the prompts to configure it)

After the code has been uploaded, select the makefile file to right-click the->make target to perform the compilation work.

If the compilation fails, you need to make the source code modification, then click Modify Source code Select upload, re-run the compilation.

5 Remote Debugging

After the code successfully compiled, if the execution results and expectations do not match, we need to enter the code debugging phase, some people say, good code is not written out, is the tune out, visible debugging work is also quite important.

For normal application debugging, it is easier to do this simply by using the menu bar's Debug button, which is not described here. This is only a brief description of the dynamic library debugging functions that I commonly use.

Since it is the dynamic library debugging, it is necessary to choose the main program to run, through debugging, connection debugger, connect to the main program process.

Click Connect debugger, the connection interface appears, select the process to connect, select the project as the current project.

Click OK to connect to the remote process.

Turn on breakpoint functionality on pre-debugged code.

Triggering the main program

The program is in the debugging phase, and you can observe the current variable by adding a custom variable.

After debugging, select Debug and complete the debugger session to terminate debugging.

6 Summary

The above describes the remote development, remote compilation, remote debugging three major functions. However, to better use NetBeans, we can also improve our efficiency by customizing shortcut keys, customizing code templates, and adding versioning, which is not covered by space constraints. Although NetBeans has been able to provide most of the functionality required for remote development, there are still a number of problems, such as the compiler Output window does not support Chinese, does not support the immediate effect of new folders, and so on, I hope in the new version of NetBeans can be improved.

References

Http://en.wikipedia.org/wiki/NetBeans

http://www.eclipse.org/ptp/

Turn: Netbean remote development of good text 2--工欲善其事, its prerequisite series--netbeans remote development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.