New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not determine Java version using executable (Java 10 build 10+44) #4503
Comments
I don't see why this would be a regression. The version you show above does not match the pattern before or after the change. It just never worked. See how the word "version" is missing:
The pattern expects
I guess we need to make the word "version" optional too. And really we should migrate to a proper API for detecting Java versions instead of parsing an unreliable String. |
Depends on how you look at it. From a user standpoint it's the same error (message) again. From a technical point, it's a different error. |
I am confused here. First there is a difference between
Note that the former includes
Note that Line 53 in 8e399da
Finally, from the initial reproduction on #3892, the issue does not reproduce with the latest JDK early access download and Gradle 4.5.1:
Note that this still fails with Gradle 4.4, as expected:
So, I do not see an issue here with this particular functionality. Would you please provide a reproduction for the actual issue that you are facing? In particular, I wonder if your IntelliJ configuration is not using Gradle 4.5.1, maybe it's using an older Gradle version? This to me is the most likely explanation. Note that if you go to: Build, Execution, Deployment > Build Tools > Gradle you can inspect the Gradle configuration. Please check this? |
I do not think this is the issue, nor do I think this change will fix the issue reported here, nor do I think this change would be correct by the specification (JEP-322); the output of |
I can't reproduce the issue either.
Executing a simple task doesn't produce a problem when parsing the Java version. @yay Can you please try this out on the command line first? After that make sure that the IDE really uses the expected Gradle version. |
Sorry, I have already reverted to 9.0.4 because of the issues with 10ea, but will try to give it another go in the coming days. |
You can still check what Gradle version your IDE is pointing to right now, independent of the JDK version that you’re using. |
I'm using Gradle 4.5.1 installed via Homebrew and I have also just downloaded the latest build of Java 10: ~ $ java --version
java 10 2018-03-20
Java(TM) SE Runtime Environment 18.3 (build 10+45)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+45, mixed mode)
~ $ java -version
java version "10" 2018-03-20
Java(TM) SE Runtime Environment 18.3 (build 10+45)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+45, mixed mode)
~ $ And I should have mentioned that I'm using Kotlin and there was an issue building or running the app with the IDE with Kotlin v1.2.21:
Error:Kotlin: [Internal Error] java.lang.ArrayIndexOutOfBoundsException: 446
Information:Kotlin: kotlinc-jvm 1.2.21 (JRE 10+45)
Information:2/28/18, 14:06 - Compilation completed with 1 error and 0 warnings in 1s 224ms
Error:Kotlin: [Internal Error] java.lang.ArrayIndexOutOfBoundsException: 446
at org.jetbrains.org.objectweb.asm.ClassReader.readUnsignedShort(ClassReader.java:2464)
at org.jetbrains.org.objectweb.asm.ClassReader.readUTF8(ClassReader.java:2525)
at org.jetbrains.org.objectweb.asm.ClassReader.readModule(ClassReader.java:761)
at org.jetbrains.org.objectweb.asm.ClassReader.accept(ClassReader.java:646)
at org.jetbrains.org.objectweb.asm.ClassReader.accept(ClassReader.java:507)
at org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleInfo$Companion.read(JavaModuleInfo.kt:67)
at org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder.findSystemModule(CliJavaModuleFinder.kt:44)
at org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder.access$findSystemModule(CliJavaModuleFinder.kt:25)
at org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder$systemModules$1.invoke(CliJavaModuleFinder.kt:37)
at org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder$systemModules$1.invoke(CliJavaModuleFinder.kt:25)
at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:149)
at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:109)
at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:133)
at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:254)
at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:241)
at kotlin.sequences.SequencesKt___SequencesKt.none(_Sequences.kt:1239)
at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.addModularRoots(ClasspathRootsResolver.kt:227)
at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.computeRoots(ClasspathRootsResolver.kt:124)
at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.convertClasspathRoots(ClasspathRootsResolver.kt:79)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.(KotlinCoreEnvironment.kt:230)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.(KotlinCoreEnvironment.kt:114)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:409)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:286)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createEnvironmentWithScriptingSupport(K2JVMCompiler.kt:276)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:155)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:63)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:109)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:53)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:92)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$1.invoke(CompileServiceImpl.kt:381)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$1.invoke(CompileServiceImpl.kt:97)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:895)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:97)
at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:925)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:894)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:379)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:844)
With Kotlin v1.2.30 (which was apparently just released today) the IDE's build/run tasks work fine now. But Gradle ones still don't. When I try to execute one via UI like this: The output is the following:
And when I try to build from terminal I get:
Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.30
$ gradle build clean --stacktrace
Which is understandable, as they probably haven't updated it yet. |
@yay After few small test, this seems to be caused by intellij, not sure why yet, but seems that this option |
You need to use the Gradle wrapper if you want to IDE to pick up the right Gradle version for your project. Otherwise it will just use the version that the IDE was built against (which is probably older). |
@jasontedor's solution worked for me. |
@namax's solution worked for me
config gradle home to libexec path, for me it's
wish help |
Interesting. I have the same issue using gradle 4.9/mac/intellij CE 2018.1.6 Using gradle wrapper, everything works fine: I'm new to gradle so this could also just be me being unfamiliar with gradle configurations. |
Always use the Gradle wrapper. IntelliJ (and Eclipse and Netbeans) don't care what you have installed on your system (as there is no standard location). If you don't use the wrapper, they will use whatever standard version they ship with. You can also manually configure the location on import, but that's not a great solution. The Gradle wrapper is always the way to go. |
I'm having this issue with all three ways to reference Gradle in IDEA. If I change back to Java 9.0.4 or 9.0.1, all works well. Homebrew has Gradle 4.7 installed. After upgrading to Gradle 4.10, this seems fixed... so I must assume it was a problem with Gradle after all. |
@namax 's solution worked for me as well, but per @oehme 's comment to always use the Gradle wrapper, I ended up modifying the
|
The same java version error for me! |
SOLVED for me, I was using jdk 11 and i just installed an earlier version JDK 7 and it worked |
Had the same problem in ubuntu. Solved it by installing jdk 8 and removing jdk 11 |
Mac: JDK 8 and local path in Gradle worked |
I am on MacOS X 10.13.6, Java 11, gradle wrapper 4.10.2. |
Hey guys, you can try changing the gradle version here: diff --git a/build.gradle b/build.gradle
index 6a65991..de8e547 100644
--- a/build.gradle
+++ b/build.gradle
@@ -91,5 +91,5 @@ configure(subprojects.findAll {it.name != 'util'}) {
}
task wrapper(type: Wrapper) {
- gradleVersion = '4.5'
+ gradleVersion = '4.10.2'
}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index be280be..fb7ef98 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip |
Then:
|
The problem can be in $JAVA_HOME. Probably the path directory is missing. |
change File: "/android/gradle/wrapper/gradle-wrapper.properties" |
I'm having issues with this too.. it some reason Gradle says my JAVA_HOME is set in the wrong place, despite it does find the exact path: C:\Program Files\Java\jdk1.8.0_191\ |
I had the same problem described by @yay and my solution was to upgrade the project from 4.2.1 to 4.10.3 and adding JAVA_HOME to my environment variables as suggested by @NovaViper. Updating to 5.0 breaks the project I'm working with, but that's likely to be expected. |
I had the same problem after upgrading from gradle 4.10 to 5.1 and the solution by @soroushm fixed it for me. |
Check your SDKs or change your Intellij JDK If you’ve upgraded a JDK recently make sure to check that the SDK paths are correct. It doesn’t have to be the SDK you’re currently using your project, it can be another version. To do this on MacOSX press F4 at the project to go to its project structure settings. Here click on SDKs and make sure that each Java JDK points to a valid folder. For example in my case the JDK 6 SDK pointed to a folder that no longer existed and once I updated that I could import the Gradle project. It’s of course also possible to delete a JDK from IntelliJ if it has been removed from disk. On a different occasion I ran into the same problem again but this time my JDKs all seemed to be in order so I couldn’t figure out what was going on. After a good deal of trail and error I tried changing the JDK version used to start IntelliJ itself from JDK 6 to JDK 8 and this resolved the problem. To do this you need to edit the Info.plist located at /Applications/.app/Contents/Info.plist. Scroll down to the section that says JVMVersion and change its value to 1.8*. For example: JVMVersion 1.8* Hope this will help you :) |
Looks like a regression to me: #3892
Tested with Gradle 4.5.1 and Java 10, on macOS 10.12.6 with IntelliJ IDEA 2017.3.4 Community Edition.
The exact message when opening a gradle project is:
Could not determine Java version using executable /Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home/bin/java.
The text was updated successfully, but these errors were encountered: