2008-08-30

NetBeans 'Main Project' Configuration Hack

I had an old folder of C++ exercises, containing a Makefile and some source files. Each source file would compile to one executable. I imported that folder into NetBeans then wondered how to run and debug each executable as a different 'Main Project'. After some twiddling, the solution (hack?) is to define different configurations for the project, one for each executable.

  1. Select your project's context menu item Set Configuration / Manage Configurations….
  2. In the Project Properties dialog, press the Manage Configurations button (I know that's rather confusing).
  3. In the Configurations dialog, create a new configuration with the target executable file name.
  4. Press the OK button to close the Configurations dialog.
  5. In the Project Properties dialog, select the Categories / Build / Make node.
  6. Select your configuration from the Configuration: drop down list. Note that you have to select any node other than General otherwise the Configuration: drop down list is disabled.
  7. In the Makefile panel:
    • Working Directory = . (current directory)
    • Build Command = ${MAKE} -f Makefile <file.exe>
    • Clean Command = ${MAKE} -f Makefile clean
    • Build Result = <file.exe>
  8. Press the OK button

Now, to run or debug a different executable, I just change the project's Active Configuration.

1 comment:

  1. Performance comments
    1.I used only Dev versions for my work
    2.I am satisfied as per my current system's configuration.
    3.It still slows down after a few hours of use, particularly if you are doing lots of project configuration changes.
    4.The default task list generation is a bad idea. By setting it to current file only, I make it work for me. WHY ?
    5.It seems that both release basically the same in context of performance. But because when I am using RC1, I also using the new JDK 6u10, it feel (not scientific, just feeling only) faster, but I suspect it is more on the Java 6u10 upgrade rather than Netbeans itself.

    ReplyDelete