Create a file protected by a password in java

Viewed 26570

I would like to create a file protected by a password in JAVA. What I mean is, once I launch the program, one file created by my program would be directly protected by previously determined password.

Is there an easy way to do it ?

Once again, my aim is not to create a file and then add it a password, but right during the creation protecting the file by a password. Actually, I want the current runner program not having access in reading/editing the created file EXCEPT if he/she has the password previously set.

So anyway, if some of you know an easy way to protect files when writing them thanks to java, I would be most grateful.

Have a nice day!

3 Answers
Related