1. A method, in a data processing system, for runtime based enforcement of energy policies, the method comprising: receiving, by an application runtime environment executing within a virtual machine on the data processing system, notification of a change in energy policy for the virtual machine or a physical host on which the virtual machine is executing; and responsive to determining the virtual machine is to be run under a power cap based on the notification of a change in energy policy, dynamically modifying, by the application runtime environment, execution of an application in the application runtime environment, wherein the application comprises a set of application modules.