1 17 package org.apache.geronimo.system.configuration.cli; 18 19 import java.io.*; 20 21 32 public class AddStartupConfiguration { 33 public static void main(String [] args) { 34 try { 35 String file = args[0]; 36 String configuration = args[1].trim(); 37 BufferedReader in = new BufferedReader(new FileReader(file)); 38 String line; 39 while((line = in.readLine()) != null) { 40 if(line.trim().equals(configuration)) { 41 in.close(); 42 System.exit(0); 43 } 44 } 45 in.close(); 46 47 PrintWriter out = new PrintWriter(new FileWriter(file, true)); 48 out.println(configuration); 49 out.close(); 50 } catch (IOException e) { 51 e.printStackTrace(); 52 System.exit(1); 53 } 54 } 55 } 56 | Popular Tags |