/Users/lyon/j4p/src/net/server/Server.java

1    package net.server; 
2     
3    import futils.Futil; 
4     
5    import java.io.File; 
6     
7    public class Server { 
8        private static String serverPath; 
9     
10       public static void main(String args[]) { 
11           startServer(args); 
12       } 
13    
14       /** 
15        figure out where the web pages 
16        and configuration files are. 
17        */ 
18       public static void setServerPath() { 
19           File f = 
20                   Futil.getReadFile("locate webserver.xml"); 
21           serverPath = f.getParent(); 
22       } 
23    
24       public static void checkResources() { 
25           File f = new File("webserver.xml"); 
26           if (f.exists()) { 
27               serverPath = f.getParent(); 
28               return; 
29           } 
30           setServerPath(); 
31       } 
32    
33       public static void startServer(String args[]) { 
34           checkResources(); 
35           if (args != null) { 
36               com.sun.web.shell.Startup.main(args); 
37               return; 
38           } 
39           startServer(); 
40       } 
41    
42       public static void startServer() { 
43           String args[] = {serverPath}; 
44           startServer(args); 
45       } 
46   }