Try the following steps:
1. Start an EC2 instance
2. Install any Java EE application server such as tomcat, glassfish or any other.
3. Install your application into the application server
After the above steps are done, you can now create an AMI of this instance or you can also create a user script which will apply these changes when your instance starts.