I downloaded the libGDX setup jar file, I generated a project and imported it (to eclipse). Once I try to run the project eclipse outputs an error:
Description Resource Path Location Type
Could not create an instance of Tooling API implementation using the specified Gradle distribution 'https://services.gradle.org/distributions/gradle-4.6-bin.zip'.
Could not create service of type FileMetadataAccessor using NativeServices.createFileMetadataAccessor().
Could not determine java version from '11.0.2'.
I have no idea how to solve this problem.
The problem is that you are using Java 11. Try it with Java 8. The HTML module does not compile with a Java version greater then 8.
Gradle 4.6 likely does not support Java 11.
You can either upgrade to a newer version of Gradle or downgrade your JDK version.
I would recommend updating to Gradle 4.10.2 as it is the latest Gradle 4 variant (you can try Gradle 5 however it may introduce some breaking changes)
This can be done by running in the root of your project:
Linux / MacOS:
./gradlew wrapper --gradle-version=4.10.2
Windows:
gradle wrapper --gradle-version=4.10.2
Related
I am trying be build a java application using "gradlew build". I have installed gradle 7.3.3
and I have java 11.0.10.
From other answers I understand that gradle is compatible with older version but here I have java 11 and latest gradle still I am getting this error.
I also tried following gradle wrapper --gradle-version 7.3.3 but it is giving me following error:
Can anyone suggest what I am missing or should differently.
EDIT: (Content of gradle.wrapper.propertiese file)
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://server_path/gradle/4.6/gradle-4.6-bin.zip
Thanks
After doing some research I found the resolution, posting so that it might help someone else.
NOTE: the gradle you installed on your machine and the gradle used by the project you are trying to build might be different. If you are in bad luck then they might be incompatible based on java version you have on your system.
I had gradle 7.3.3 on my system and the project was using gradle 4.6. The gradle used by project is not compatible with java 11. So, to be on safe side I downgraded both Gradle (to v 4.6) and java (to 1.8) and it worked.
You might not required to downgrade the gradle version on your local machine. I will try that as well and update this answer.
EDIT: It worked with Gradle 7.3.3, java 1.8 and the project using Gradle 4.6.
Spring Boot Project
I'm using gradle 5.2.1 I can't change the version because I'm working on someone else's code. When I build the project in IntelliJ I get the following error:
* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokeHelper
I'm using IntelliJ terminal in my code folder with command ./gradlew clean build install.
when I check ./gradle -version it shows JVM: 16.0.2
I feel the problem is with my jdk version.
As per compatibility matrix , only gradle versions of 7 are supporting java 16.
May be you can use older version of jdk which is supporting your current gradle.
When I try to build the project:
5:33 pm Gradle sync started
5:33 pm Gradle sync failed: Could not determine java version from '11.0.8'.
The project uses Gradle version which is incompatible with Studio running on Java 10 or newer.
See details at https://github.com/gradle/gradle/issues/8431
Possible solution:
- Upgrade Gradle wrapper to 4.8.1 version and re-import the project
(2 s 910 ms)
5:33 pm Android Studio is using the following JDK location when running Gradle:
/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
Using different JDK locations on different processes might cause Gradle to
spawn multiple daemons, for example, by executing Gradle tasks from a terminal
while using Android Studio.
More info...
Select a JDK from the File System
Do not show this warning again
When I press the link to upgrade Gradle:
Could not determine java version from '11.0.8'.
The project uses Gradle version which is incompatible with Studio running on Java 10 or newer.
See details at https://github.com/gradle/gradle/issues/8431
Possible solution:
- Upgrade Gradle wrapper to 4.8.1 version and re-import the project
It is saying I have Java 11.0.8 when the JDK location is very clearly pointing at Java 8, and changing the Gradle version fails.
The steps I took to fix this were to make sure JDK was < 10 which it states it has to be. Since JDK = 8, this should be fulfilled.
Thanks for any advice.
I am running into an issue. I am trying to build my code which is a legacy one built on Java 1.6. However, when i am trying to build it using ANT with a similar version then run into the JRE version 1.7 or greater is supported. I tried following instructions with Eclipse NEON but no luck.
https://blog.sibvisions.com/2016/06/30/eclipse-neon-with-ant-and-jre6/
I have a Eclipse Oxygen IDE and tried with it too but even it doesn't work.
The only challenge I can't move to the latest version while building .xml file is because the hosting server supports JDK 1.6 only.
Incase, if there is a way out then please suggest.
P.S:- added the error message in the below comment.
HERE IS THE ERROR MESSAGE
the JRE version 1.7 or greater is supported"
The ANT plugin form blog.sibvisions.com was created for Neon or Mars. There's a new plugin available for Oxygen.1. Simply search the blog.
The problem with eclipse is that the standard ANT plugin was created based on Java 7 and it has a version check built-in. It's not possible to use the standard ANT plugin with Java6... So use an older eclipse version or the modified ANT plugin.
I don't know the reason why the original ANT plugin is using Java 7 because the source can be written with Java 6 compatibility without problems. This is what the modified ANT plugin does.
I had a project which is build on java 1.6 and
Now i upgraded the java verion to 1.8 and build the project
Here i have used gradle for building the project
Here is the gradle code
task wsgen(dependsOn: compileJava) {
doLast{
ant {
taskdef(name:'wsgen',
classname:'com.sun.tools.ws.ant.WsGen',
classpath:configurations.jaxws.asPath)
wsgen(keep:true,
destdir: "${buildDir}",
resourcedestdir:"${sourceSets.main.output.resourcesDir}",
sourcedestdir:'src/main/java',
genwsdl:'true',
classpath:"${configurations.compile.asPath}:${sourceSets.main.output.classesDir}",
sei:'<sei implementation class>')
}
}
}
and the error , am getting is
java.lang.NoClassDefFoundError: com/sun/mirror/apt/AnnotationProcessorFactory
Can any one tell me, where the issue is located and raising from?
Thank you!!!
Thanks go out to #McDowell for the useful comment with links. So the APT tool is gone. Use a version 7 JDK for building your project. Just install it alongside your java 8 JDK and create a script specifically for building your project that requires the APT tool.
I had the same problem and went around it by running maven using the 1.7 version of JDK. So I created a script (.cmd on windows platform) that, for me, looks like this:
set JAVA_HOME="c:\Java\ibm-jdk-1.7.0"
set PATH=%JAVA_HOME%\bin;%PATH%
mvn clean install eclipse:eclipse
This will successfully build using an IBM version of the java 7 jdk, which i happen to have in my java folder. I hate the fact that I can't build my projects with the version 1.8 jdk but at least i can use java 8 features on other projects.