When I try to open a project by clicking at my build.gradle, I see this message:
Could not fetch model of type 'BasicIdeaProject' using Gradle distribution
'http://services.gradle.org/distributions/gradle-1.4-bin.zip'. The supplied
javaHome seems to be invalid. I cannot find the java executable. Tried location:
C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 12.1\jre\bin\java.exe
I think this happens because IntelliJ searches jre at the wrong folder, because in my IntelliJ directory, I have this sctructure:
C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 12.1\jre\jre\bin\java.exe
Of course I can move the ...\jre\jre\bin folder to the ...\jre, but if I do this, I see this another message, when try openning the project:
Error: could not open `C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 12.1\jre\lib\i386\jvm.cfg'
That is, it can't find the lib folder. Again, I can copy the ...\jre\jre\lib folder to the ...\jre folder, but already there is a folder called lib at the ...\jre folder, that contains only the file tools.jar.
So, how can I do IntelliJ to search at right folder?
Update:
This is my JAVA_HOME
:
C:\Program Files (x86)\Java\jre7
From the "Ideaj Quick Start" select "Configure"->"Project Defaults"->"Project Structure"
From there in the popup that follows, select "SDKs" -> (under Platform Setting on the left) and make sure that the locations of your 1.6 and 1.7 are correct (I was off by an update apparently)
I faced the same error and checked project structure several times. Everything was just fine. I started facing this error after upgrade from intellij 14.0 to 14.1.1. The solution worked for me is following, pasting it here so that other can be benefited from it too.
Go into the jre file and if you find another jre file inside it. Move the files in that other jre to the first jre file and everything should work just fine. When move just don't delete anyfile for example the lib folder is also persent inside and outside of JREs; outside one has tools.jar that probably might be needed. So complete copy without replace should work just fine.
I feel it is bug in intellj when you upgrade the version it messes up with configuration.
I hope this helps others.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With