The Arduino development environment is probably the preferred development platform for the majority of Arduino users. It is lean and relatively easy to use. Quite a few examples are at your finger tip and even for people without much programming experience, it is relatively easy to get started. You can write and upload your sketches (programs) without the need to ever leave the IDE.

Despite its convenience, the Arduino IDE lacks some key features most modern IDEs have. To name a few, the Arduino IDE does not yet support auto-completion, code folding and contextual help. And the integrated parser sometimes have difficulties parsing complex code structures and do not give adequate information for the errors encountered. While it does not matter much for writing simple programs, the drawbacks are obvious when developing more complex applications. Since I am a software developer, I personally prefer a more advanced IDE.

If you are using Eclipse, then there is already a plugin available for AVR development, though I have not personally tried it I have seen other people using it regularly. Looking at the Arduino playground instructions for this plugin, it seems that it is pretty straight forward to set up. But if you are using NetBeans, currently there’s no Arduino support yet.

Luckily, it is actually fairly straight forward to add Arduino support in the NetBeans environment. In this article, I will show you step by step instructions on how to prepare your NetBeans environment for Arduino development purpose.

For those who are impatient and know your way around the NetBeans environment, you can download and install ArduinoPlugin_v1.0.tar.gz (Tools -> Plug-ins, under Downloaded tab, choose add plug-ins) and get started right away. You do need to configure your NetBeans environment to support avr-gcc tool chain before you can start using the Arduino module. If you are unsure how to do this, please read on.


This plugin requires a functional Arduino development environment. Since this plug-in relies on the Arduino core libraries for code compilation, Arduino must be installed first. You can refer to the Getting Started with Arduino guide on the official Arduino site on how to install the Arduino programming environment.

The instructions in this article assumes that you are running Arduino under Linux, but I think you can adapt it to Windows environment with relatively few changes. Here is a list of the software versions I have installed on my PC.

Ubuntu 10.04 (64bit)
avr-gcc 4.3.4
avrdude 5.10
NetBeans 6.8

Depending on your particular settings (e.g. the installation path of arduino-0018 is not located under your home directory or it is installed under a different directory name), minor modifications to the template might be needed.

Configure AVR Tool Chain

To setup the NetBeans environment, we need to first setup the AVR tool chain. To do so, first launch NetBeans, navigate to Tools -> Options and click “Add” under C/C++/Build Tools (see screen shot below), and from there we can create a new tool chain called Arduino and configure the paths in the right-hand-side pane accordingly. Here is a screenshot of the tool chain configuration on my system:

Base Directory: /usr/bin
C Compiler: /usr/bin/avr-gcc
C++ Compiler: /usr/bin/avr-g++
Assembler: /usr/bin/avr-as
Debugger: /usr/bin/gdb (this is not important since we do not run Arduino applications within NetBeans anyway)

avr-gcc tool chain setup in NetBeans
avr-gcc tool chain setup in NetBeans

In order for the auto-complete feature to work with the Arduino/AVR header files, we also need to setup the paths under the Code Assistance tab. To begin with, you would need to setup the following paths:

~/arduino-0018/hardware/arduino/cores/arduino (assuming that you installed Arduino 0018 under your home directory)

If you use libraries located in other locations, you will need to add those paths to the C/C++ compiler code assistance tab as well.

Install the Arduino Plugin

To install the plugin, download the NetBeans module first (ArduinoPlugin_v1.0.tar.gz). Use the following command to extract the NetBeans Module (ArduinoPlugin_v1.0.nbm):

tar zxf ArduinoPlugin_v1.0.tar.gz

Then go to Tools -> Plugins, under Downloaded tab, choose Add plugins. Navigate to where you saved the .nbm file and click OK.

After installing the plugin, the plugin option screen should look like the following:

Arduino Plugin installed
Arduino Plugin installed

How to use

To create an Arduino project, go to project new and choose Arduino project template.

Create an Arduino Project
Create an Arduino Project

After the project is created, you should see two files (main.pde and makefile) under Source Files folder, and main.pde contains the code skeleton:

#define __AVR_ATmega328P__

#include <binary.h>
#include <HardwareSerial.h>
#include <pins_arduino.h>
#include <WConstants.h>
#include <wiring.h>
#include <wiring_private.h>
#include <WProgram.h>
#include <EEPROM/EEPROM.h>

void setup()


void loop()


I tried to make the code structure look as close to that in Arduino IDE as possible, but for the code auto completion to work, some extra includes are needed. Also, note that I have included the MCU definition (#define __AVR_ATmega328P__) to get the the MCU specific intellisense work. You can change this to the type of MCU you are targeting.

Auto Completion
Auto Completion

To build your project, right click on the makefile and choose make or make clean. If your build is successful, you should see a HEX file built in the applet directory within your project root. And you can use the Make Target -> upload option to upload the HEX file onto the Arduino board.

Build and Upload
Build and Upload

Behind the scene

The Arduino plugin for NetBeans is developed as a NetBeans project sample module. The makefile is adapted from the make file used within the Arduino environment and is discussed here.

I had put some additional comments in places where you might need to edit for it to work with your projects. For instance, your project may link to more modules than the ones listed below.

#Note that if your program has dependencies other than those
#already listed below, you will need to add them accordingly.
$(ARDUINO)/wiring_pulse.c \
$(ARDUINO)/wiring_analog.c \
$(ARDUINO)/pins_arduino.c \
$(ARDUINO)/wiring.c \
$(ARDUINO)/wiring_digital.c \
$(ARDUINO)/WInterrupts.c \
$(ARDUINO)/wiring_shift.c \

$(ARDUINO)/Tone.cpp \
$(ARDUINO)/main.cpp \
$(ARDUINO)/WMath.cpp \
$(ARDUINO)/Print.cpp \
$(ARDUINO)/HardwareSerial.cpp \

Also, I followed the technique used in the Arduino IDE to assemble the sketch with other necessary information and the main program at compile time (see the portion of the makefile below) to keep main.pde as simple as possible. The only issue is that compilation errors are referenced against the assembled source code rather than the code you write in main.pde. I had originally thought about putting all the necessary code in main.pde and thus would not require code merge at compile time, but it would make the code less compatible with the Arduino IDE environment.

#applet_files: main.pde
applet/$(TARGET).cpp: main.pde
# Here is the “preprocessing”.
# It creates a .cpp file based with the same name as the .pde file.
# On top of the new .cpp file comes the WProgram.h header.
# and prototypes for setup() and Loop()
# Then the .cpp file will be compiled. Errors during compile will
# refer to this new, automatically generated, file.
# Not the original .pde file you actually edit…
test -d applet || mkdir applet
echo ‘#include “WProgram.h”‘ > applet/$(TARGET).cpp
echo ‘void setup();’ >> applet/$(TARGET).cpp
echo ‘void loop();’ >> applet/$(TARGET).cpp
cat main.pde >> applet/$(TARGET).cpp

Future Enhancement

Currently, there is no serial port monitor integrated with the NetBeans environment. So if your code uses the Serial class (i.e. Serial.println()), you will have to use the serial monitor bundled with Arduino. This should not be a big issue though, since even in Arduino, you have to click on the Serial Monitor every time after you upload the code to use it any way. I am planning on integrating the serial monitor with NetBeans in the future but it would probably take some time.


Arduino plugin for NetBeans: ArduinoPlugin_v1.0.tar.gz

Update 12/17/2011

I have updated the plugin and the makefile for Arduino 1.0. These updates can be found here.

Be Sociable, Share!

51 Thoughts on “Arduino Development Using NetBeans”

  • Hi!

    Thank you very much for the post and the plugin! I’ve been looking for something like this for sometime and very happy came across your work.

    I’d would like a bit more of your help, because and I am using your plugin on Windows. And some issues have arisen.

    First. There is a Resolve Missing Tools, that for now I solved just clicking OK.
    Second. There is warning about the difference between Windows host platform and the project configuration platform, that I could solve manually changing the platform parameter in configuration.xml file
    Third. And this is more important I got a lot of make errors, like these:

    Makefile:232: warning: overriding commands for target `applet/Documents’
    Makefile:162: warning: ignoring old commands for target `applet/Documents’
    Makefile:232: warning: overriding commands for target `and’
    Makefile:162: warning: ignoring old commands for target `and’
    Makefile:232: warning: overriding commands for target `Mis’
    Makefile:162: warning: ignoring old commands for target `Mis’
    make: Circular applet/Documents <- applet/Documents dependency dropped.
    make: Circular and <- applet/Documents dependency dropped.
    make: Circular and <- and dependency dropped.
    make: Circular Mis <- applet/Documents dependency dropped.
    make: Circular Mis <- and dependency dropped.
    make: Circular Mis <- Mis dependency dropped.
    # Here is the "preprocessing".
    "#" no se reconoce como un comando interno o externo,
    programa o archivo por lotes ejecutable.
    make: *** [Arduino.cpp] Error 1
    BUILD FAILED (exit value 2, total time: 141ms)

    I hope you can help me with these questions and I am very grateful in advance for your time and possible help.

    Kind regards,

    • Hi Victor,

      First, thanks for trying the plugin on Windows. After looking at your errors, I am suspecting that your problem was probably caused by the differences between how NetBeans platform behaves on Windows and Linux.

      For instance, there are many places in the make file that are platform dependent. You will need to install cygwin on Windows for those linux-only portion to work properly.

      If you could give that a try and let me know your results, I can help you further trouble-shoot the problem. Thanks.

  • Excellent post! I don’t develop for Arduino yet, but it’s nice to know that my favorite IDE supports it somehow.

    BTW, nice skin! Where did you found it?

  • Hi Kerry,

    Cool plugin and I’d love to start using it, but I can’t seem to get Netbeans to play nice on my setup (Ubuntu 10.04 64bit). It just keep running my (dualcore) CPU up to 200% and does nothing. How did you get it to work? Since I’ve switched back to good old 6.7.1 your plugin won’t install.

    • Hi kerry, somehow now 6.8 seems to work…

      but upon installing your plugin i get:
      Some plugins require plugin Utilities API to be installed.
      The plugin Utilities API is requested in version >= but only was found. The following plugin is affected:       ArduinoModule

      any hints? google gave me nothing…

      • Looks like it could be some version conflict… did you update your NetBeans IDE (Help->Check for Updates) after you installed your IDE? Besides this warning message, did it work?

  • Thanks a lot for this howto; I’ve a problem:
    I can see code and syntax highlighting but I don’t have code completion working.

    I’ve followed step by step your instruction and triple checked all option…what I’m missing about you?

    Thank you

    • sorry…I’m very stupid; I don’t know I’ve to press CRTL+SPACE to have suggestions:
      There’s a way to have automatic suggestions?

        • hello,
          4xcheck…it works if I hit CTRL+SPACE, but not automatically (but is not a problem)

          Another quesion:
          If I write code for arduino into netbeans I have to change something?
          because I’m trying to use some code that works into arduino-018 ide but don’t work into netbeans…this is a sample code:

          //example use of LCD4Bit_mod library


          //create object to control an LCD.

          //number of lines in display=1

          LCD4Bit_mod lcd = LCD4Bit_mod(2);

          //Key message

          char msgs[5][15] = {“Right Key OK “,

          “Up Key OK “,

          “Down Key OK “,

          “Left Key OK “,

          “Select Key OK” };

          int adc_key_val[5] ={30, 150, 360, 535, 760 };

          int NUM_KEYS = 5;

          int adc_key_in;

          int key=-1;

          int oldkey=-1;

          void setup() {

          pinMode(13, OUTPUT); //we’ll use the debug LED to output a heartbeat


          //optionally, now set up our application-specific display settings, overriding whatever the lcd did in lcd.init()

          //lcd.commandWrite(0x0F);//cursor on, display on, blink on. (nasty!)


          lcd.printIn(“KEYPAD testing… pressing”);



          Netbeans won’t let me use this line:

          LCD4Bit_mod lcd = LCD4Bit_mod(2);

          used to create a lcd object…

          I’m missing something?

          • Hi Crash,

            The makefile supplied with the plugin does not contain include paths to all the libraries. If you are using libraries that are not defined in that file, you will need to add the corresponding library to the C_MODULES or CXX_MODULES variables in the make file. And you may need to add the library path to CINCS and CXXINCS as well.

            For instance, a project I am working on relies on LiquidCrystal and Wire Library and I needed to make the following modifications to the makefile (LiquidCrystal and Wire are the two added references):

            C_MODULES = \
            $(ARDUINO)/wiring_pulse.c \
            $(ARDUINO)/wiring_analog.c \
            $(ARDUINO)/pins_arduino.c \
            $(ARDUINO)/wiring.c \
            $(ARDUINO)/wiring_digital.c \
            $(ARDUINO)/WInterrupts.c \
            $(ARDUINO)/wiring_shift.c \
            $(ARDUINO_LIB)/Wire/utility/twi.c \

            CXX_MODULES = \
            $(ARDUINO)/Tone.cpp \
            $(ARDUINO)/main.cpp \
            $(ARDUINO)/WMath.cpp \
            $(ARDUINO)/Print.cpp \
            $(ARDUINO)/HardwareSerial.cpp \
            $(ARDUINO_LIB)/EEPROM/EEPROM.cpp \
            $(ARDUINO_LIB)/LiquidCrystal/LiquidCrystal.cpp \
            $(ARDUINO_LIB)/Wire/Wire.cpp \

            CINCS = -I$(ARDUINO) -I$(ARDUINO_LIB) -I$(ARDUINO_LIB)/Wire/utility

            And here is the include directives in main.pde to reference these libraries:


  • Thank you Kwong,
    I’m not explainen well…

    I’m not in trouble compiling (not now…) I’ve trouble coding.

    Netbeans mark RED underline on the code line I’ve told you.

    • Crash, if you can compile successfully the red underline simply means that the IDE could not find the definition of the method/classes you are using and that usually means you will have to setup the Code Assistance paths (or you could just ignore it). But if you cannot compile the code (e.g. the compiler is complaining about not recognizing the underlined code) it means that you will need to include the include path. Hope it helps.

  • Hi Kerry,

    I’m stuck with the .cpp file not being able to find the included libraries. Here’s a screenshot of the error:

    Makefile locations:

    Code Assistant settings:

    Do you have any idea on what I might be missing for those libraries?

    Many thanks for the great tutorial!

    • If you right click on the makefile and choose “Make Clean” and than do a make, you should see the command used to invoke the avr-g++ in the output window (you may need to scroll to the top). You will see one line for each included library, for example:

      /usr/bin/avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -DF_CPU=16000000L -DARDUINO=18 -I/home/kwong/arduino-0018/hardware/arduino/cores/arduino -I/home/kwong/arduino-0018/libraries -mmcu=atmega328p /home/kwong/arduino-0018/hardware/arduino/cores/arduino/wiring_pulse.c -o /home/kwong/arduino-0018/hardware/arduino/cores/arduino/wiring_pulse.o

      If you look at the parameters to -I, do they show the correct paths?

      • This is what I get:

        /usr/local/avr/bin/avr-gcc -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -DF_CPU=16000000L -DARDUINO=19 -I/Users/Frankenteddy/Applications/ -I/Users/Frankenteddy/Applications/ -mmcu=atmega328p applet/YodaBotColours.cpp -o applet/YodaBotColours.o

        No mention of wiring_pulse at all. Any ideas?

        • I think I know what the issue was. You’ll need to manually add all the C_module and Cxx_modules to the makefile:

          C_MODULES = \
          $(ARDUINO)/wiring_pulse.c \
          $(ARDUINO)/wiring_analog.c \
          $(ARDUINO)/pins_arduino.c \
          $(ARDUINO)/wiring.c \
          $(ARDUINO)/wiring_digital.c \
          $(ARDUINO)/WInterrupts.c \
          $(ARDUINO)/wiring_shift.c \

          And it should fix your problem. Good luck!

  • I’m trying to compile the 3310 LCD shield example under Netbeans.

    I have no problem compiling the blink example but when I try to compile the example in this archive: I get scope decleration errors:

    applet/Arduino.cpp:60: error: ‘temperature’ was not declared in this scope
    applet/Arduino.cpp:61: error: ‘charmap’ was not declared in this scope
    applet/Arduino.cpp:62: error: ‘bitmap’ was not declared in this scope
    applet/Arduino.cpp:63: error: ‘about’ was not declared in this scope

    I don’t have any of these problems if I compile with the Arduino 019 IDE.

    I have also tried the same thing using eclipse setup for AVR and have the same results. Blink will compile, nokia 3310 lcd example will not because of scope declaration errors.

    • Did you copy the nokia_3310_lcd library to your arduino\library folder? And also you will need to modify your make file (see my previous comment) to make sure that the library sources are referenced in either C_MODULES or CXX_MODULES depending on whether it’s c++ or plain c code.

      • Yes, the library is in the arduino\library folder. I have added them to the makefile. Here are the lines I added:
        C_MODULES = \
        $(ARDUINO_LIB)/nokia_3310_lcd/n3310_lcd.c \

        CXX_MODULES = \
        $(ARDUINO_LIB)/nokia_3310_lcd/nokia_3310_lcd.cpp \

        Are you able to compile the example?

        • same for me.
          I’m having problems using the Nokia 3310 LCD library. It seems that the plugin cannot find the library, though the lib is in the arduino library path and the path is added to the makefile.

  • Hi!

    Im trying to run this at a macbook, but getting this error:
    /bin/sh: line 4: exec: make: not found

    MAKE FAILED (exit value 127, total time: 132ms)

    Any ideas how to fix it?

  • Hi Kerry,

    Great writeup! I would love to see the next generation with a serial console. I don’t think it would be that hard to do – I’ll take a crack at it as soon as I get your plug-in installed. Speaking of…

    I can’t seem to locate the nbm file in the tar ball referenced above. Here are the contents of the expanded directory:

    abby@fruitfly:~$ ls -R Downloads/ArduinoPlugin_v1.0/
    Info META-INF netbeans



    config modules




    • abeille,

      The attached ArduinoPlugin_v1.0.tar.gz (towards the end of the article) should expand to ArduinoPlugin_v1.0.nbm and you can then use Tools->Plugins to import it. Did you try adding the plugin?

  • I got everything working so i can compile and upload through netbeans. puzzled as to why intellisense doesn’t work for Serial.begin(9600). Any help on this?

  • Hi!
    I installed netbeans version 7.0 and I cannot configure the avr tool chain.. Under tools->options it doesn’t have a C/C++ tab. And I can’t find anything similar whatsoever.
    Have anyone tryed this in this new Netbeans version?
    Thanks in advance.
    Rui Jorge.

      • Problem solved! :)
        As this steps didn’t work for me (NetBeans couldn’t find pins_arduino.h, wiring.h, etc), I spent the last hour trying to figure out what was wrong and it was a simple thing after all and I would like to share it with you people!
        Mr. Wong made this using version 18 of Arduino IDE but…If you’re using a different version of Arduino IDE you have to change that parameter in the makefile!

        As I’m using version 22 of the Arduino software, under the makefile – in line 40 – instead of “INSTALL_DIR = $(HOME)/arduino-0018” I now have: “INSTALL_DIR = $(HOME)/arduino-0022”.

        Now I can compile everything perfectly (!) but NetBeans does not AutoComplete some code.. As Jeff O’Brien described, the autocomplete does not work for Serial.begin… Anyway, it’s not a major problem, as it compiles fine…
        But that’s not the end of the road for me… I cannot upload the sketch to the Arduino board. When I go to “make target”, the only options shown are: ‘all’, ‘build’ and ‘clean’.
        Help please?

        • One more thing!
          When I try to use an Arduino library, for example ‘#include ‘, it says that OneWire.h could not be found. This happens with every single library. I’ve also tryed to use Arduino v18 as you pointed out but still no go. Any hints?

      • Cannot upload! :(
        I’m trying to upload via the internal terminal of NetBeans by typing ‘make upload’…
        I’ve tryed different baud rates (19200, 57600 and 115200) and I also tryed stk500, stk500v1 and stk500v2.
        The TX led brights up but nothing’s uploaded… This is what I get with stk500v1 @ 115200:
        “avrdude: stk500_getsync(): not in sync: resp=0x00
        avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x00

        avrdude done. Thank you.

        make: *** [upload] Error 1”

        Help, please?
        btw I’ve managed to get the libraries recognized so everything is fine now. I just can’t upload the hex file…

          • The output is what i’ve written in my last comment.
            Anyways, I’ve got it working yesterday at night…
            I’ve added the following to the CINCS and CXXINCS lines: -I`pwd`. I also changed the baud rate to 57600.
            Now it works! I can only upload it through the terminal but it’s fine for me.
            I’m sorry to saturate your page with comments but I have one more question to you!
            Each time I create a new project, I have to copy the makefile from one of the last projects (’cause the original one does not work for me).
            Is there any way to make my makefile persistent to any new arduino projects?

  • Hello kwong I followed his guide to install arduino but I have to pluing difficonte with (ArduinoPlugin_v1.0.tar.gz) because when I unzip the archive *. nbm files so I can not install the pluing. I am using Product Version: NetBeans IDE 6.9 (Build 100825-unknown-revn)
    Java: 1.6.0_22; OpenJDK 64-Bit Server VM 20.0-b11
    System: Linux version 6.2.38-13-generic running on amd64; UTF-8, en_US (nb)
    Userdir: / home/movid/.netbeans/6.9
    Ubuntu 11.04 Maveric.
    I hope you can give me an idea of what to do.
    thanks Leandro

  • Hello kwong I followed his guide to install arduino but I have to pluing difficonte with (ArduinoPlugin_v1.0.tar.gz) because when I unzip the archive I do not find *. nbm files so I can not install the pluing. I am using Product Version: NetBeans IDE 6.9 (Build 100825-unknown-revn)
    Java: 1.6.0_22; OpenJDK 64-Bit Server VM 20.0-b11
    System: Linux version 6.2.38-13-generic running on amd64; UTF-8, en_US (nb)
    Userdir: / home/movid/.netbeans/6.9
    Ubuntu 11.04 Maveric.
    I hope you can give me an idea of what to do.
    thanks Leandro

  • Thanks for providing a great utility. It all worked fine for me with one exception. I can build hex files but do not get the option to upload them to the board. I get the options to make, make all, make clean and add target. Any suggestions as to what needs changing would be appreciated. I am using Ubuntu 10.4 and Netbeans 7.1.

    • Hi John,

      You will have to add the upload option manually by right clicking on the makefile and choose Make Target->Add Target and add the upload target name. Then you can right click and choose upload to upload the hex file generated.

  • Hi Kerry,
    good work. I really appreciate it.
    Make runs through without errors.
    I got two questions:
    Why does the compiler complain about the statement ‘Serial.begin(9600)’ with: ‘Unable to resolve identifier Serial’ and finsih compiling flawlessly ?
    How can I configure that F11 builds executes the ‘make all’ ?
    Thank you.

    • Hi Harald,

      If it compiles correctly but the IDE does not recognize some keywords, it means that that the code assistance can not locate the header file. You will need to add the path to the library header files in Options/C/C++/Code Assistance if I remember correctly. As to how to make F11 work, I don’t know if you can without writing some kind of plugin code.

  • having no serial monitor is a big issue,
    especialy on linux … if i do a screen in the termnal, the arduino is not available anymore even after unplug/replug…

    i know linux sucks but sometimes one have no choice

    so ain integrated serial monitor would be THE feature to integrate

  • hello, im a beginner and new to programming MCUs, I found your project here

    Im interested in building this project but i do not know how to make changes in the header files to make it compatible with the Arduino IDE.
    Ive also read the instructions above but i do not have a linux computer to do this. Could you provide a pde file that I can just copy paste and upload to the arduino mcu?? I would really be thankful.

Leave a Reply

Your email address will not be published.