Skip to content
Advertisement

Simulate touch command with Java

I want to change modification timestamp of a binary file. What is the best way for doing this?

Would opening and closing the file be a good option? (I require a solution where the modification of the timestamp will be changed on every platform and JVM).

Advertisement

Answer

The File class has a setLastModified method. That is what ANT does.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement