You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2002/01/24 00:26:04 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util IntrospectionUtils.java

costin      02/01/23 15:26:04

  Modified:    src/share/org/apache/tomcat/util IntrospectionUtils.java
  Log:
  Check for tools.jar existence and try java.home/lib/tools.jar too, for the
  few vms using a 'strange' layout or setting java.home to JAVA_HOME.
  
  Revision  Changes    Path
  1.16      +22 -4     jakarta-tomcat/src/share/org/apache/tomcat/util/IntrospectionUtils.java
  
  Index: IntrospectionUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/IntrospectionUtils.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- IntrospectionUtils.java	20 Sep 2001 03:46:32 -0000	1.15
  +++ IntrospectionUtils.java	23 Jan 2002 23:26:04 -0000	1.16
  @@ -185,7 +185,10 @@
   	    if( path.endsWith( jarName ) ) {
   		home=path.substring( 0, path.length() - jarName.length() );
   		try {
  -		    File f=new File( home );
  +                    if( "".equals(home) ) {
  +                        home=new File("./").getCanonicalPath();
  +                    }
  +                    File f=new File( home );
   		    File f1=new File ( f, "..");
   		    install = f1.getCanonicalPath();
   		    if( installSysProp != null )
  @@ -472,9 +475,24 @@
       public static void addToolsJar( Vector v )
       {
   	try {
  -	    v.addElement( new URL( "file", "" ,
  -				   System.getProperty( "java.home" ) +
  -				   "/../lib/tools.jar"));
  +            // Add tools.jar in any case
  +            File f=new File( System.getProperty( "java.home" ) +
  +                             "/../lib/tools.jar");
  +
  +            if( ! f.exists() ) {
  +                // On some systems java.home gets set to the root of jdk.
  +                // That's a bug, but we can work around and be nice.
  +                f=new File( System.getProperty( "java.home" ) +
  +                                 "/lib/tools.jar");
  +                if( f.exists() ) {
  +                    System.out.println("Detected strange java.home value " +
  +                                       System.getProperty( "java.home" ) +
  +                                       ", it should point to jre");
  +                }
  +            }
  +            URL url=new URL( "file", "" , f.getAbsolutePath() );
  +
  +	    v.addElement( url );
   	} catch ( MalformedURLException ex ) {
   	    ex.printStackTrace();
   	}
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>