Another solution would be to create AppleScript containing the folowing code
tell application "Finder"
empty the trash
end tell
save it as emptytrash
for example and execute it via open emptytrash.app
or even better (as suggested by Chris) - execute:
osascript -e 'tell app "Finder" to empty'
Since trash is a Finder thing, this should be more compatible in the long run.