import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.io.File; public class GetAllSubPackages { static PrintWriter writer; public static void main(String[] args) { if (args.length < 2) { System.out.println("First command line argument is the destination file"); System.out.println("where the package names will be stored"); System.out.println("Rest of the arguments are directory paths to the packages"); System.out.println("Example:"); System.out.println( "java GetAllSubPackages packages.txt rootdir1 rootdir2 rootdirN"); return; } try { writer = new PrintWriter(new BufferedWriter(new FileWriter(args[0]))); for (int i=1; i