Also adds Java API for doing the same to Java threads (standard Java Thread.setPriority only works when Java is run as root, even if the process has the right privileges).