Either use the property java.io.tmpdir as indicated or use the servlet context attribute javax.servlet.context.tempdir defined in the specification. For tomcat that attribute can be changed by the workDir attribute on the context.
You can use that attribute by a call to servletContext.getAttribute("javax.servlet.context.tempdir")
See tomcat documentation for detail.