There are few ways to do that:
- You can use Java API (as you mentioned); can be called within a Java Program
- Use WebService API; can be called from within any server side program (e.g. .Net /JSP/Servlet/PHP etc)
- You may directly update the status of each process in Database (Highly not-recommended)
PS: If you want to permanently delete the records from Database, use Process Purge Tool. I hope this will work only on COMPLETED process instances.
Nith