Article based on the orginal located here: http://wiki.ubnt.com/UniFi_FAQ#Can_I_run_UniFi_Controller_as_a_Windows_Service.3F
Make sure UniFi is not running
Locate your java installation directory.
On 64-bit, it's usually at "C:\Program Files (x86)\Java\jre6\bin"; otherwise "C:\Program Files\Java\jre6\bin". (replace jre6 for jre7 if you have the latest Java)
Add the dir above to the PATH (from Computer->Properties->Advanced system settings)