 <p>I would strongly recommend that you look at build tools like Ant or Maven. They are defacto standard for Java projects and will help you to achieve such tasks.</p> <p>Look at this link: <a href="http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html" rel="nofollow">http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html</a></p> <p>It will basically take 5 minutes of your time to understand the basic principles of Maven and perhaps 30 more to know how to use a plugin to to exactly what you want. If I had known five years ago about Maven it would literally saved weeks of my time.</p>