ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/types CommandlineJava.java
Date Wed, 18 Jul 2001 10:07:03 GMT
bodewig     01/07/18 03:07:03

  Modified:    src/main/org/apache/tools/ant/taskdefs Javadoc.java
               src/main/org/apache/tools/ant/types CommandlineJava.java
  Log:
  Apply the same magic <javadoc> uses to locate the javadoc command to
  CommandlineJava (and with thus to <java fork="true">).
  
  Suggested by:	Jesse Glick <Jesse.Glick@netbeans.com>
  
  Also, add .exe on OS/2 as well.
  
  This still doesn't work for IBM's JDK 1.3 on AIX (java is in
  JAVA_HOME/jre/sh and javac in JAVA_HOME/sh) - need to find out what
  java.home points to and where javadoc is, before we can fix that.
  
  Revision  Changes    Path
  1.57      +6 -4      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
  
  Index: Javadoc.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- Javadoc.java	2001/07/17 14:54:13	1.56
  +++ Javadoc.java	2001/07/18 10:07:02	1.57
  @@ -1145,10 +1145,12 @@
   
       private String getJavadocExecutableName()
       {
  -	// This is the most common extension case - exe for windows, nothing
  -	// for *nix.
  -	String extension = (System.getProperty("os.name").toLowerCase().indexOf("windows") >=
0) ?
  -	    ".exe" : "";
  +	// This is the most common extension case - exe for windows and OS/2, 
  +        // nothing for *nix.
  +        String os = System.getProperty("os.name").toLowerCase();
  +        boolean dosBased = 
  +            os.indexOf("windows") >= 0 || os.indexOf("os/2") >= 0;
  +	String extension =  dosBased? ".exe" : "";
   
   	// Look for javadoc in the java.home/../bin directory.  Unfortunately
   	// on Windows java.home doesn't always refer to the correct location, 
  
  
  
  1.13      +24 -1     jakarta-ant/src/main/org/apache/tools/ant/types/CommandlineJava.java
  
  Index: CommandlineJava.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/CommandlineJava.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- CommandlineJava.java	2001/03/02 16:00:38	1.12
  +++ CommandlineJava.java	2001/07/18 10:07:02	1.13
  @@ -128,7 +128,7 @@
       }
   
       public CommandlineJava() {
  -        setVm("java");
  +        setVm(getJavaExecutableName());
           setVmversion(org.apache.tools.ant.Project.getJavaVersion());
       }
   
  @@ -254,4 +254,27 @@
           javaCommand.clearArgs();
       }
   
  +    private String getJavaExecutableName() {
  +	// This is the most common extension case - exe for windows and OS/2, 
  +        // nothing for *nix.
  +        String os = System.getProperty("os.name").toLowerCase();
  +        boolean dosBased = 
  +            os.indexOf("windows") >= 0 || os.indexOf("os/2") >= 0;
  +	String extension =  dosBased? ".exe" : "";
  +
  +	// Look for java in the java.home/../bin directory.  Unfortunately
  +	// on Windows java.home doesn't always refer to the correct location, 
  +	// so we need to fall back to assuming java is somewhere on the
  +	// PATH.
  +	java.io.File jExecutable = 
  +            new java.io.File(System.getProperty("java.home") +
  +                             "/../bin/java" + extension );
  +
  +	if (jExecutable.exists()) {
  +	    return jExecutable.getAbsolutePath();
  +	} else {
  +	    return "java";
  +	}
  +    }
  +    
   }
  
  
  

Mime
View raw message