The use of partial evaluation for specializing programs written in imperative languages such as C and Java is hampered by the difficulty of controlling the specialization process. We have developed a simple, declarative language for controlling the specialization of Java programs, and interfaced this language with the JSpec partial evaluator for Java. This language, named Pesto, allows declarative specialization of programs written in an object-oriented style of programming. The Pesto compiler automatically generates the context information needed for specializing Java programs, and automatically generates guards that enable the specialized code in the right context. Categories and Subject Descriptors D.3.4 [Software]: PROGRAMMING LANGUAGES—Processors General Terms Design, Languages Keywords Partial evaluation, declarative specialization, Java