I'm making this Login bit to a larger program, and I want to save the time of when a failed login happens and save the timestamp to a file called FailedLogins.txt. The problem is,"No suitable method found for write(Timestamp)", when I put the time stamp variable in the fwriter.write().
try {
writer = new BufferedWriter( new FileWriter("UserPass.txt"));
fwriter = new BufferedWriter( new FileWriter("FailedLogins.txt"));
if(ppassword.equals(rrepassword)) {
writer.write("Name: " + ffname + " " + llname + "\n");
writer.write("Email: " + eemail + "\n");
writer.write("Password: " + ppassword + "\n\n");
}
else {
password.setText("");
repassword.setText("");
JOptionPane.showMessageDialog(null, "Your passwords do not match.");
//For Failed Logins text File
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
fwriter.write(timestamp);
}
}
catch ( IOException e) {
}
finally {
try {
if ( writer != null) {
writer.close( );
}
}
catch ( IOException e) {
}
}
Any Ideas?