Reputation: 191
I'm new to libGDX, I created an empty project for desktop and HTML. No problem when I'm running desktop but when I'm running HTML with ./gradlew html:superDev
Console error
Task :html:draftCompileGwt FAILED
Exception in thread "main" java.lang.NoSuchMethodError:
com.google.gwt.util.regexfilter.RegexFilter: method <init>()V not found
at com.google.gwt.util.regexfilter.WhitelistRegexFilter.<init>
(WhitelistRegexFilter.java:21)
at com.google.gwt.dev.jjs.JJSOptionsImpl.<init>
(JJSOptionsImpl.java:54)
at com.google.gwt.dev.PrecompileTaskOptionsImpl.<init>
(PrecompileTaskOptionsImpl.java:39)
at com.google.gwt.dev.CompilerOptionsImpl.<init>
(CompilerOptionsImpl.java:30)
at com.google.gwt.dev.Compiler.main(Compiler.java:108)
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':html:draftCompileGwt'.
Process 'command '/usr/lib/jvm/java-12-openjdk-amd64/bin/java''
finished with non-zero exit value 1
build.gradle (html)
gwt {
gwtVersion='2.8.2' // Should match the gwt version used for building the gwt backend
maxHeapSize="1G" // Default 256m is not enough for gwt compiler. GWT is HUNGRY
minHeapSize="1G"
src = files(file("src/")) // Needs to be in front of "modules" below.
modules 'com.mygdx.game.GdxDefinition'
devModules 'com.mygdx.game.GdxDefinitionSuperdev'
project.webAppDirName = 'webapp'
compiler {
strict = true;
disableCastChecking = true;
}
}
import org.wisepersist.gradle.plugins.gwt.GwtSuperDev
def HttpFileServer server = null
def httpFilePort = 8080
task startHttpServer () {
dependsOn draftCompileGwt
String output = project.buildDir.path + "/gwt/draftOut"
doLast {
copy {
from "webapp"
into output
}
copy {
from "war"
into output
}
server = new SimpleHttpFileServerFactory().start(new File(output), httpFilePort)
println "Server started in directory " + server.getContentRoot() + ", http://localhost:" + server.getPort()
}
}
task superDev (type: GwtSuperDev) {
dependsOn startHttpServer
doFirst {
gwt.modules = gwt.devModules
}
}
task dist(dependsOn: [clean, compileGwt]) {
doLast {
file("build/dist").mkdirs()
copy {
from "build/gwt/out"
into "build/dist"
}
copy {
from "webapp"
into "build/dist"
}
copy {
from "war"
into "build/dist"
}
}
}
task addSource {
doLast {
sourceSets.main.compileClasspath += files(project(':core').sourceSets.main.allJava.srcDirs)
}
}
tasks.compileGwt.dependsOn(addSource)
tasks.draftCompileGwt.dependsOn(addSource)
sourceSets.main.java.srcDirs = [ "src/" ]
eclipse.project {
name = appName + "-html"
}
I did not add any code, this is the project created by libGDX
Ubuntu 19.04
Java version : 12.0.1
Gradle version : 5.4.1
Gradlew version: 5.4.1
If you have an idea of the problem I take it. Thank you.
Upvotes: 1
Views: 1061
Reputation: 191
Problem solved. The origin was my java version
Old java version
java -version
openjdk version "12.0.1" 2019-04-16
OpenJDK Runtime Environment (build 12.0.1+12-Ubuntu-1)
OpenJDK 64-Bit Server VM (build 12.0.1+12-Ubuntu-1, mixed mode, sharing)
So I have to change version, command to do it
sudo update-alternatives --config java
In my case here is the result
Sélection Chemin Priorité État
------------------------------------------------------------
* 0 /usr/lib/jvm/java-12-openjdk-amd64/bin/java 1211 mode automatique
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 mode manuel
2 /usr/lib/jvm/java-12-openjdk-amd64/bin/java 1211 mode manuel
3 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 mode manuel
I switched to version 8, for do this 2 solutions this command
sudo update-java-alternatives --set "/path/java/..."
or with this command sudo update-alternatives --config java
you can directly select the version
Current java version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-0ubuntu1.19.04.2-b03)
OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)
And it's work fine
Upvotes: 2