Of course, the best way to ensure a password is safe is having a "no return to the original", but that's out of the scope of this question :-)
Having said that, your best option is to encrypt the password on the application code side, using a Private Key that exists only on the server (but not deployed together with the app). You can take a look at Jasypt, which is a tool for encryption for Java. Also, you might want to consider splitting the passphrase for the key into two parts: one coming from some configuration file inside the properties file, and one coming from, perhaps, the database itself.