In this paper we define and evaluate a framework for estimating the energy consumption of Java-based software systems. Our primary objective in devising the framework is to enable an engineer to make informed decisions when adapting a system's architecture, such that the energy consumption on hardware devices with a finite battery life is reduced, and the lifetime of the system's key software services increases. Our framework explicitly takes a componentbased perspective, which renders it well suited for a large class of today's distributed, dynamic, and mobile applications. The framework allows the engineer to estimate the software system's energy consumption at construction time and refine it at runtime. In a large number of distributed application scenarios, the framework showed very good precision on the whole, giving results that were within 5% (and often less) of the actually measured power losses incurred by executing the software. While our empirical evidence suggests that the framework is broadly applicable as-is, our work to date has highlighted a number of future enhancements.