KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > memoire > vainstall > VAInstall


1 /**
2  * $RCSfile: VAInstall.java,v $
3  * @creation 26/01/99
4  * @modification $Date: 2005/03/06 23:04:18 $
5  */

6
7 package com.memoire.vainstall;
8
9 import java.io.File JavaDoc;
10 import java.io.IOException JavaDoc;
11
12 /**
13  * @version $Id: VAInstall.java,v 1.4 2005/03/06 23:04:18 deniger Exp $
14  * @author Axel von Arnim
15  */

16
17 public class VAInstall {
18
19     public static void main(String JavaDoc[] args) {
20
21         String JavaDoc javaVersion = System.getProperty("java.version");
22
23         if (javaVersion.indexOf("1.4.") != -1) {
24             // JDK 1.4
25

26             if (args != null && args.length == 1 && args[0].equals("-gui") == true) {
27                 try {
28                     Object JavaDoc controller = Class.forName("com.memoire.vainstall.builder.VAIBuilderController").newInstance();
29                 } catch (Exception JavaDoc exc) {
30                     exc.printStackTrace();
31                 }
32                 return;
33             }
34         }
35
36
37         if ( args.length < 1 ) {
38             usage();
39             System.exit(1);
40         }
41
42         File JavaDoc propFile = new File JavaDoc(args[0]);
43         if ( (propFile.exists()) && (propFile.canRead()) ) {
44             try {
45                 VAProperties.PROPERTIES.loadProperties(propFile);
46             } catch( IOException JavaDoc exc ) {
47                 exc.printStackTrace();
48             }
49         } else {
50             if (args[0].equals("-gui") == true) {
51                 System.err.println("'-gui' only supported on Java 1.4");
52             } else {
53                 System.err.println(args[0]+" can not be read.");
54             }
55             System.exit(1);
56         }
57
58         VAArchiver archiver=new VAArchiver();
59         archiver.start();
60
61         System.exit(0);
62
63     }
64   
65     public static void usage() {
66         System.out.println("Usage: java "+new VAInstall().getClass().getName()+" <.vai file>");
67     }
68
69 }
70
Popular Tags