On 14/10/2011, at 1:47 PM, blackwolf wrote:
> 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?
My guess is that bin/java is a link to jre/bin/java. If so, you might try your
test with a milestone-5 snapshot, which should give you the expected result.
--
Adam Murdoch
Gradle Co-founder
http://www.gradle.org
VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting
http://www.gradleware.com