[GRADLE-2803] Cannot use daemon with JRE that is part of a JDK as JAVA_HOME Created: 21/Jun/13  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: 1.6
Fix Version/s: None

Type: Bug
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Won't Fix Votes: 0


The problem is that the daemon client reports its JAVA_HOME as the jre, but on the daemon runs with the containing JDK as the JAVA_HOME. This prevents the client from connecting to the daemon as the JAVA_HOMEs do not match.

See the linked forum post for more details.

Comment by Gradle Forums [ 21/Jun/13 ]

Is there any way that you can provide a reproducible sample that we can use?

Comment by Gradle Forums [ 21/Jun/13 ]

I believe that if you set ModelBuilder.setJavaHome("C:
Program Files\\Java\\jdk1.6.029
jre"), then it will reproduce, assuming that "C:
Program Files\\Java
jdk1.6.029" is a directory of a JDK. I will try to create a simple script which may reproduces the problem.

Comment by Gradle Forums [ 21/Jun/13 ]

Here is a simple Gradle build which reproduces the issue: [1]https://gist.github.com/anonymous/565...
Running `gradle jdkTask` reproduces the issue (although the `jreHomeInJdk` line has to be changed appropriately).
[1] https://gist.github.com/anonymous/5658997

Comment by Gradle Forums [ 21/Jun/13 ]

Do you get the same thing if you use the JDK root dir instead of the JRE child dir?

Comment by Gradle Forums [ 21/Jun/13 ]

No, it works if I specify the JDK root dir.

Comment by Michael Barnathan (Inactive) [ 18/May/16 ]

I thought this was curious, since the java.home system property should point to the JRE directory by default and thus the two should match. We appear to be munging the path when we attempt to locate the JVM manually (twice on Windows, we do it there to tools.jar as well), but we're content to allow the JRE path to remain intact when manually specified.

I think we should eliminate the path munging in the automatic case and allow the embedded JRE of a JDK distribution to be used directly. Any thoughts? I don't have the context on why we're doing this in the first place - if the user wants to run Gradle out of a JRE underneath the JVM distribution, we should allow them to.

An alternative if we can't do that is to make this daemon comparison insensitive to the "/jre" suffix, since they should be the same version of Java.

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 12:31:58 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.