KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnode > Made > CDL > Main


1 /* $Id: Main.java,v 1.1.1.1 2003/02/11 16:19:40 bures Exp $ */
2 package SOFA.SOFAnode.Made.CDL;
3 import java.io.File JavaDoc;
4
5 /** class for running CDL */
6 public class Main {
7
8   static class GCThread extends Thread JavaDoc {
9     public void run() {
10       System.gc();
11       try {
12         Thread.sleep(1000);
13       } catch (Exception JavaDoc e) {;}
14     }
15   }
16   
17   private static File JavaDoc[] testArgv(String JavaDoc[] argv) {
18     int i, n = 0;
19     File JavaDoc[] f = new File JavaDoc [argv.length];
20     for(i=0; i<argv.length; i++) {
21       f[n] = new File JavaDoc(argv[i]);
22       if (f[n].exists())
23         n++;
24       else
25         Output.out.println("File "+argv[i]+" doesn't exist.");
26     }
27     File JavaDoc[] ret = new File JavaDoc [n];
28     for (i=0; i<n; i++) {
29       ret[i] = f[i];
30     }
31     return ret;
32   }
33
34   public static void main(String JavaDoc[] argv) {
35     try {
36       /*
37       GCThread gct = new GCThread();
38       gct.setDaemon(true);
39       gct.start();
40       */

41       Output.setOut(new ConsoleLogger());
42       System.setSecurityManager(new java.rmi.RMISecurityManager JavaDoc());
43     
44       File JavaDoc[] f = testArgv(argv);
45       if (f.length == 0) {
46         Output.out.println("No file to compile");
47         System.exit(1);
48       }
49       parser.run(f);
50     } catch (Exception JavaDoc e) {
51       Output.out.println("Exception: "+e.getMessage());
52       e.printStackTrace();
53     } catch (Error JavaDoc e) {
54       Output.out.println("Error: "+e.getMessage());
55       e.printStackTrace();
56     }
57   }
58 }
59
Popular Tags