How To Recursively Delete Files And Directories Using JavaJune 15th, 2006 How can you recursively delete files and directories in windows? You can select them in explorer (in windows) and delete it, right?
The problem with the explorer approach is that if one or more files and / or directories cannot be deleted then the whole process fails. Try cleaning your Local Settings\temp directory to see an example.
Java Program: Compare two text filesApril 29th, 2009 Today while managing the comments, I got a request of this sort. HI,
I have a small question in java.
How To Simulate Telnet Session in JavaFebruary 16th, 2006 Often we come across procedures which need to be performed by issuing commands in a telnet session. It is relatively easy to do it manually but is definitely not suitable for automation.
Shutdown Apache James Mail Server - Java UtilityFebruary 15th, 2006 Overview
A Java class to shutdown Apache James Mail Server via TCP/IP. It shuts down Apache James Mail Server by passing shutdown command via simulated telnet session.
JDK1.5 - More painful bugs aka Enumeration-Woes: Solved!August 29th, 2004 Current Status: Solved
Defect:
When more than one annotation type files are compiled in javac(any of the ways like *.java or @srclist or FileName1.java FileName2.java)
then it emits and error message that it cannot find symbol for statically imported Enums. However statically importing one level up and de-referencing works.
Java Software: 1-Line Sort & Uniq UtilityOctober 18th, 2005 I had to sort and uniq (create a unique set of strings) a large list with lots of duplicate. My options were to write it in Java or download cygwin and run: cat file | sort | uniq > result
Cygwin download never works for me.
How To Fix - Couldn't find per display information Error in Java ApplicationsJune 23rd, 2008 While running some Java applications (like Thinreader) you may see this strange looking error - Couldn't find per display information. You may find this error when running such applications in JDK 6 or later.
Grid Computing: Sun Offers 100, 000 in Grid Compute Utility Cool Apps PrizeMay 19th, 2006 Sun Microsystems (SUNW) is hosting Grid CoolApps Developer Challenge - a contest to develop applications for Sun Grid Compute Utility and the 'coolest' applications win!
There are two ways to compete - the best application that runs on Sun Grid Compute Utility, and the best application built with the Compute Server Plugin for NetBeans. In addition to US residents this contest is open to international participants too, those who cannot access the Sun Grid Compute Utility today.
Apple Released Java Security Update for Mac OS XApril 19th, 2006 The Java 2 Standard Edition 5.0 Release 4 update, issued Monday, fixes a vulnerability in Java Web Start. An application, exploiting the vulnerability, may grant itself permissions to read and write local files that are accessible to the user running the Java Web Start application.
J2SE 5: New wine in new bottle with old corkMarch 15th, 2005 J2SE stands for Java 2 Standard Edition. The 2 stands for version 2 of the platform.
Java Quiz: Why StringBuilder Should be Used Instead of StringBuffer?August 23rd, 2008 First tell me what is the best way to concatenate large number of String objects? Is it a + b?
Most Java developers know not to use a + b (+ operator) because of huge performance problems, they use StringBuffer instead. In fact I did some tests in the past which confirms this folklore.
How To Clean Subversion DirectoriesJune 15th, 2006 When you checkout a repository from subversion it creates a .svn directory (with subdirectories) for every directory (and subdirectory) checked out. The .svn directory contains information about the repository and files in the directory and allows you to run svn commands without having to authenticate yourself in future.
Guide To Simplified Java Logging using Java Core APIJanuary 17th, 2006 Java comes in with a handy logging package (java.util.logging) which eliminates the need to use external logging packages like Log4J. However it still requires some configuration which makes it cumbersome and repetitive to include in every class.
Java SE Goes Beta (Feature Complete). Download Now.February 17th, 2006 Java SE 6 Beta offers the first feature complete version of next major release of the Java SE platform. Sun expects to ship the final release of Java SE 6 in the fall of 2006.
Three Free Notable Java Software / APISeptember 8th, 2005 GMail API for Java
GMailer API for Java (g4j) is set of API that allows Java programmer to communicate to GMail. With G4J programmers can made Java based application that based on huge storage of GMail.
March 17th, 2007 at 7:13 am
There’s a problem with the recursinion in the touch method.
This line:
if(file.isDirectory()) for(File childFile:file.listFiles()) touch(file, time);
should be:
if(file.isDirectory()) for(File childFile:file.listFiles()) touch(childFile, time);
July 5th, 2007 at 8:00 am
Thanks. Corrected.
November 27th, 2007 at 1:29 pm
Thanks for this little utility!
It would be nice if you could also correct the class file..
July 2nd, 2009 at 5:39 am
I needed a version that added a delta to each timestamp. Here is what I did:
public class TouchDelta {
public static void main(String[] args) throws Exception {
long delta = Long.valueOf(args[0]); // ms to add
for(int i=1; i<args.length; i++) touchDelta(new File(args[i]), delta);
}
public static void touchDelta(File file, long delta) {
if(file.isDirectory()) for(File childFile:file.listFiles()) touch(childFile, delta);
file.setLastModified(file.lastModified()+delta);
}
}
Enjoy - Jim.