First of all! You are not trying to save a file in the user home directory! You are requesting the home directory and trying to parse out the drive where the home directory is located.
Second: My question to you is: Are you trying to save a file on the filesystem of the server? Because this is what you are doing! You are asking the home directory of the user who is running the server. In a servlet you are not able to write files on the client's filesystem and I think that this is what you want to do.
Of course this works in your development environment because the server and client are located on the same system.
Tell me if I am wrong! Maybe you should explain a little more about what you are trying to do exactly and then we can help you more!
What does "it's not working" mean - do you get an exception, or does it appear to do nothing at all?
What is the value of the system property "user.home" on the test system? Add some log statements (maybe just simple System.out.println(...) statements) to your code to find out what's happening when you run it on the test system.