In this paper we present a novel scheme for portable CPU accounting and control in Java, which is based on program transformation techniques and can be used with every standard Java Virtual Machine. In our approach applications, libraries, and the Java Development Kit are modified in order to expose details regarding the execution of threads. Each thread accounts for the number of executed bytecode instructions and periodically the threads of an application component aggregate the information of their respective CPU consumption within a shared account and invoke scheduling functions that are able to prevent applications from exceeding their allowed CPU quota.