You may be able to bypass the form by directly submitting a
POST request via Java.
The author of
this article on DevX.com claims to have developed a solution to submitting multi-part POST forms involving file uploads and cookies, and has made the (as he calls it) ClientHTTPRequest
source code available for download. You can find
docs for it as well.
There are a number of commercial Java APIs that provide the desired functionality, but I doubt you will consider that a viable option.
You may also want to look into the Java
Robot API.