public static void main(String[] args) throws Exception {
if (args.length != 3)
throw new IllegalArgumentException( "Wrong number of arguments" );
args[ 0 ] = args[ 0 ].replace( '/', File.separatorChar );
File buildFile = new File( args[ 0 ] );
StringBuffer sb = readFile( buildFile );
String tokenStr = "< property name=\"" + args[ 1 ] + "\" value=\"";
int i = sb.indexOf( tokenStr );
if (i < 0)
throw new IllegalArgumentException( "Can't find token: " + tokenStr );
int j = i + tokenStr.length();
while ( sb.charAt( j ) != '"' )
j++;
sb.replace( i + tokenStr.length(), j, args[ 2 ] );
writeFile( buildFile, sb );
}
|