com/repdev/launcher/Launcher.java
author ryan
Tue, 30 Jun 2009 15:24:45 -0400
branchcurrent-development
changeset 452 a86c195127e7
parent 425 b98ede012e03
permissions -rw-r--r--
build.xml tweaks (more exclusions)

modified launcher to not try and svn update

rebuilt launcher executable (repdev.exe)

generated dist (not included in version control)
     1 package com.repdev.launcher;
     2 
     3 import java.io.BufferedReader;
     4 import java.io.InputStreamReader;
     5 import java.io.PrintStream;
     6 import java.text.SimpleDateFormat;
     7 import java.util.Date;
     8 
     9 /**
    10  * This is a <s>simple</s> launcher for a JAR file that will be wrapped with Launch4J to create
    11  * a nice friendly repdev.exe that will run for anyone.
    12  * 
    13  * Supports logging all output to a file, subversion updating (or not with the arg --no-update)
    14  * 
    15  * @author Ryan Schultz
    16  *
    17  */
    18 public class Launcher {
    19 	private static final String date = SimpleDateFormat.getInstance().format(new Date());
    20 
    21 	public static void main(String[] args) throws Exception {
    22 		boolean log = false;
    23 		for(String arg: args) {
    24 			if( arg.equals("--log") )
    25 				log = true;
    26 			if( arg.equals("--help") || arg.equals("-h") ) {
    27 				usage();
    28 				System.exit(1);
    29 			}
    30 		}
    31 
    32 		if( log ) {
    33 			PrintStream stderr = new PrintStream("stderr.txt");	
    34 			System.setErr(stderr);
    35 
    36 			PrintStream stdout = new PrintStream("stdout.txt");
    37 			System.setOut(stdout);
    38 
    39 			System.out.println(">> RepDev Started via launcher with logging");
    40 			System.out.println(">> Started: " + date + "\n");
    41 			System.err.println(">> RepDev Started via launcher with logging");
    42 			System.err.println(">> Started: " + date + "\n");
    43 		}
    44 
    45 		// Finally, we launch repdev...
    46 		com.repdev.RepDevMain.main(args);		
    47 	}
    48 
    49 	private static void usage() {
    50 		String[] usage = {
    51 				"RepDev Launcher - Usage:",
    52 				"",
    53 				"\tCommand\tAction",
    54 				"\t--help or -h\tThis message",
    55 				"\t--log\tLog all output to stdout.txt and stderr.txt",
    56 				"",
    57 		};
    58 		
    59 		for( String line: usage )
    60 			System.out.println(line);
    61 	}
    62 
    63 }