Hi,

I have the following build.gradle:

// Prints out the the absolute path of the 'java' executable.
task blah {
   ProcessBuilder processBuilder = new ProcessBuilder("which", "java")
   processBuilder.redirectErrorStream(true)
   Process process = processBuilder.start()
   process.waitFor()
   if (process.exitValue() != 0) {
      return null
   }

   BufferedReader reader = new BufferedReader(new
InputStreamReader(process.getInputStream()))
   String line = reader.readLine()
   println line
   println (new File(line))
   println file(line)
   return line
}

The result I get is:

/usr/lib/jvm/java-6-sun-1.6.0.26/bin/java
/usr/lib/jvm/java-6-sun-1.6.0.26/bin/java
/usr/lib/jvm/java-6-sun-1.6.0.26/jre/bin/java

Is this the expected behavior? If so, what's the motivation behind it?


--
View this message in context: 
http://gradle.1045684.n5.nabble.com/Weird-file-resolution-for-absolute-path-of-the-java-executable-tp4901245p4901245.html
Sent from the gradle-user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to