tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@locus.apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/startup Main.java
Date Fri, 13 Oct 2000 00:58:39 GMT
nacho       00/10/12 17:58:38

  Modified:    src/share/org/apache/tomcat/startup Main.java
  Log:
  Dynamical loading of jars for java -jar execution, every jar
  inside %TOMCAT_HOME%/lib get into the classpath.
  
  Revision  Changes    Path
  1.11      +25 -8     jakarta-tomcat/src/share/org/apache/tomcat/startup/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/startup/Main.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Main.java	2000/09/17 07:52:44	1.10
  +++ Main.java	2000/10/13 00:58:37	1.11
  @@ -188,7 +188,7 @@
           try {
   	    if( ! base.endsWith( "/" ) )
   		base=base + "/";
  -	    
  +
   	    File f = new File(base + file);
   	    String path = f.getCanonicalPath();
   	    if( f.isDirectory() )
  @@ -199,7 +199,7 @@
   	    return null;
           }
       }
  -	
  +
       public String getLibDir() {
   	if( libBase!=null ) return libBase;
   
  @@ -224,19 +224,20 @@
       }
   	
       
  -    String cpComp[]=new String[] { "../classes/", "jaxp.jar",
  +/*    String cpComp[]=new String[] { "../classes/", "jaxp.jar",
   				   "parser.jar", "jasper.jar",
   				   "webserver.jar",
                                      "tomcat_core.jar", "tomcat_util.jar",
                                      "tomcat_modules.jar", "tomcat_config.jar",
   				   "facade.jar", "servlet.jar"};
  -    
  +*/
       void execute( String args[] ) throws Exception {
   
   	try {
  -	    int jarCount=cpComp.length;
   	    Vector urlV=new Vector();
  -
  +            String cpComp[]=getJarFiles(getLibDir());
  +	    int jarCount=cpComp.length;
  +            urlV.addElement( getURL(  getLibDir() ,"../classes/" ));
   	    for( int i=0; i< jarCount ; i++ ) {
   		urlV.addElement( getURL(  getLibDir() , cpComp[i] ));
   	    }
  @@ -283,7 +284,7 @@
   	    setAttribute( proxy, "parentClassLoader", parentL );
   	    setAttribute( proxy, "serverClassPath", urls );
   	    execute(  proxy, "execute" );
  -	    return; 
  +	    return;
   	} catch( Exception ex ) {
   	    ex.printStackTrace();
   	}
  @@ -372,7 +373,23 @@
   		}
   	    }
   	}
  +    }
  +
  +    public String[] getJarFiles(String ld) {
  +	File dir = new File(ld);
  +	String[] names = dir.list( new FilenameFilter(){
  +            public boolean accept(File dir, String name) {
  +                if (name.endsWith(".jar"))
  +                {
  +                    return true;
  +                }
  +                return false;
  +            }
  +        } );
  +	return names;
       }
  - 
   
  +
   }
  +
  +
  
  
  

Mime
View raw message