Hi,
I have a text will with encrypted data which show as special character in the file and plain text. If I read and write to another file I get only question marks for the special characters. But this only occurs when I run it from a jar file from the command prompt.
If I run the code from a IDE it works correctly. So I am really hosed on this one. I run the JAR file on Solaris with does not works. I also run the file in Eclipse IDE on Solaris and it works. This also happens if I try to append to the file. The data in the file looks like
w383 ~I~Y~D~A��~U~G
w384 ~D| �~X�~U~\~Y
cm89 ~Q����~\~A�
After I run from the jar file it looks like:
w383 ~I~Y~D~A��~U~G
w384 ~D| �~X�~U~\~Y
cm89 ~Q����~\~A�
w385 ???????
Here is the code I uses.
String nameFile = "/usr/files/passfile";
String addTxt = userId + " " + pCode + "\n";
boolean status = false;
try {
BufferedWriter out = new BufferedWriter(new FileWriter(nameFile,
true));
out.write(addTxt);
out.close();
status = true;
logger.info("\n\nAdded user: " + userId + " to password file: "
+ nameFile + "\n\n");
} catch (IOException e) {
// e.printStackTrace();
logger.info("\n\n"+e.getMessage());
}
Thanks