You haven't exactly said what you want to happen. It sort of looks like you want to save the file on the user's desktop, which might not even be a meaningful thing in some environments where
Java runs. But I suppose you could choose some environments to support, and then do some hard-coding for each of those environments. But I'd really review whether you want to force the user to have that file on their desktop in the first place. Sure, it might work for you but other users might want it somewhere else. I know, it's always difficult trying to guess what somebody else might want.