ATMEGA 1284p java.lang.NullPointerException


I am trying to use the ATMEGA 1284p. First I tried burning the arduino bootloader on, and it said it worked, but then wouldn't let me program it. I tried to burn the bootloader on again and start from scratch, but now I get the error:

at cc.arduino.packages.uploaders.SerialUploader.burnBootloader(
Error while burning bootloader.

I have checked my wiring about 100 times and also used 4 different sources of bootloader code. Nothing makes a difference. I am even uninstalled the Arduino program and begun again, and still I get this error.

Any suggestions?

Please give a list of the exact steps required to reproduce this.

Have you bootloaded to use Internal or External clock?

If external clock then you need a crystal connected to XTAL1 and 2 and two 22pf caps to GND

Or use the ISP sketch like this, which provides pin 9 as clock and can connect to XTAL1 pin of 1284p. I am using this sketch to program chips which uses external clock fuse using Arduino Uno.

Enable verbose upload and post the full text. Usually the cause of Java errors is hinted at on the links immediately before the error