burning bootloader to ATmega1284p

I am using the Arduino Uno as an ISP programmer to burn the "original mighty 1284p 16mhz" bootloader to a 1284p but when i press burn bootloader i get this error (which I have no idea what it means):

Arduino: 1.6.5 (Windows 8.1), Board: "Original Mighty 1284p 16MHz"

Error while burning bootloader.

java.lang.NullPointerException

at cc.arduino.packages.uploaders.SerialUploader.burnBootloader(SerialUploader.java:305)

at processing.app.Editor$59.run(Editor.java:2578)

at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)

at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)

at java.awt.EventQueue.access$500(EventQueue.java:97)

at java.awt.EventQueue$3.run(EventQueue.java:709)

at java.awt.EventQueue$3.run(EventQueue.java:703)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)

at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

Any help is greatly appreciated

Try Nick Gammon's bootload installer sketch instead:

'1284P is shown down at the bottom of the page.