exporting packages through java service

can somebody give me code/guide me on how to export packages using java service… I need to take scheduled backup of the packages.

Their is no need to create a custom java service to export the packages.
You can use the in built wmpublic services to create a back up packges in replicate/Inbound folder.These services are avaliable in pub.replicater folder of wmpublic packges.

Also you can use the package available at

http://www.wmusers.com/software/browse.shtml?keys=backup

that creates the back up of all the packages.