How to get files from TFS (java) and then compile those and place it into destination

Hi,

I want to get files from TFS for a different project mostly a java project, once i get the files i want to compile them via eclipse or JRE and send the compile classes to a destination folder.
I am thinking i can use copy files from the TFS path and then use a recording for compiling it through eclipse and then again use copy files to move to destination.
The destination will also be on a remote server.
Could anyone guide me if this approach is fine or there is a better way to do it ?

Thanks.