TeaVM fails to compile Java 17

241 views
Skip to first unread message

a a

unread,
Jun 19, 2023, 10:41:37 AM6/19/23
to TeaVM
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 61
2023-06-19T09:31:16.727-0500 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   at org.teavm.asm.ClassReader.<init>(ClassReader.java:195)


Do I need to use Java 8 for TeaVM?

Alexey Andreev

unread,
Jun 19, 2023, 10:43:17 AM6/19/23
to TeaVM
No, you can use TeaVM with Java 17. Are you using old version of TeaVM?

понедельник, 19 июня 2023 г. в 16:41:37 UTC+2, ilent...@gmail.com:

a a

unread,
Jun 19, 2023, 12:13:41 PM6/19/23
to TeaVM
I'm using TeaVM 0.6.0

Heres my build.gradle file

buildscript {
repositories {
mavenCentral()
}

dependencies {
classpath 'io.github.zebalu:teavm-gradle-plugin:+'
}
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'io.github.zebalu.teavm-gradle-plugin'

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

sourceSets {
main {
java {
srcDir 'src/main/java'
}
}
}

repositories {
mavenCentral()
}

dependencies {
implementation 'org.teavm:teavm-platform:0.6.0'
implementation('org.teavm:teavm-classlib:0.6.0') {
exclude group: 'com.google.code.gson', module: 'gson'
}
}

teavm {

compileScopes = null;
minifying = false;
maxTopLevelNames = 10000;
properties = null;
debugInformationGenerated = false;
sourceMapsGenerated = true;
sourceFilesCopied = false;
incremental = false;
transformers = null;

/** Where to save the result */
targetDirectory = file("javascript");

/** The directory to monitor to decide if compile is up-to-date or not */
sourceDirectory = file("src");

/** How to name the result file. */
targetFileName = "classes.js";

/** Which class holds your public static void main(String[] args) method */
mainClass = 'net.me.Main';

/** This will be the name of your main method after compilation. */
entryPointName = 'main';

classesToPreserve = null;
stopOnErrors = false;
optimizationLevel = "ADVANCED"; //org.teavm.vm.TeaVMOptimizationLevel.SIMPLE;
fastGlobalAnalysis = false;
targetType = "JAVASCRIPT"; //org.teavm.tooling.TeaVMTargetType.JAVASCRIPT;
cacheDirectory = null;
wasmVersion = "V_0x1"; //org.teavm.backend.wasm.render.WasmBinaryVersion.V_0x1;
minHeapSize = 4;
maxHeapSize = 128;
outOfProcess = false;
processMemory = 512;
longjmpSupported = true;
heapDump = false;

/** Add name of configurations here where to look for jarfiles. */
includeJarsFrom = [];

/** By default teavmc task depends on javaCompile task, unless this variabale is true. */
skipJavaCompile = false;
}

Alexey Andreev

unread,
Jun 19, 2023, 12:17:38 PM6/19/23
to te...@googlegroups.com

1. Update to lastest TeaVM, which is currently 0.8.1 (optionally, you can update to preview build, see https://teavm.org/docs/tooling/gradle.html)

2. Use native TeaVM gradle plugin, see https://teavm.org/docs/tooling/gradle.html

--
You received this message because you are subscribed to the Google Groups "TeaVM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to teavm+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/teavm/95c654b9-2403-4ded-a867-d29bdd323f65n%40googlegroups.com.

a a

unread,
Jun 19, 2023, 12:37:08 PM6/19/23
to TeaVM
I'm new to using gradle, how do I fix this?
An exception occurred applying plugin request [id: 'org.teavm', version: '0.8.1']
> Failed to apply plugin 'org.teavm'.
   > Extension of type 'SourceSetContainer' does not exist. Currently registered extension types: [ExtraPropertiesExtension, TeaVMExtension]

plugins {
id "org.teavm" version "0.8.1"
}
repositories {
mavenCentral()
}

a a

unread,
Jun 19, 2023, 12:37:47 PM6/19/23
to TeaVM
My understanding is that I need to register SourceSetContainer somewhere, but where?

Alexey Andreev

unread,
Jun 19, 2023, 2:03:54 PM6/19/23
to te...@googlegroups.com

You need to apply some language plugin first, e.g. Java or Kotlin

a a

unread,
Jun 19, 2023, 4:45:52 PM6/19/23
to TeaVM
I have fixed that, but now it says it's missing dependencies?

repositories {
mavenCentral()
}

dependencies {
// https://mvnrepository.com/artifact/org.teavm/teavm-core
implementation group: 'org.teavm', name: 'teavm-core', version: '0.8.1'
// https://mvnrepository.com/artifact/org.teavm/teavm-classlib
implementation group: 'org.teavm', name: 'teavm-classlib', version: '0.8.1'
// https://mvnrepository.com/artifact/org.teavm/teavm-jso
implementation group: 'org.teavm', name: 'teavm-jso', version: '0.8.1'
// https://mvnrepository.com/artifact/org.teavm/teavm-tooling
implementation group: 'org.teavm', name: 'teavm-tooling', version: '0.8.1'
// https://mvnrepository.com/artifact/org.teavm/teavm-junit
testImplementation group: 'org.teavm', name: 'teavm-junit', version: '0.8.1'
}
Screenshot 2023-06-19 154211.png

Alexey Andreev

unread,
Jun 20, 2023, 3:55:56 AM6/20/23
to TeaVM
I'm not sure where did you get this configuration. You can read documentation, here and here. You can also find plenty of examples here. You don't need these dependencies, however this should not affect the build in general. I have no idea, why things don't work on your side.

I have fixed that, but now it says it's missing dependencies?

repositories {
mavenCentral()
}

dependencies {
// https://mvnrepository.com/artifact/org.teavm/teavm-core
implementation group: 'org.teavm', name: 'teavm-core', version: '0.8.1'
// https://mvnrepository.com/artifact/org.teavm/teavm-classlib
implementation group: 'org.teavm', name: 'teavm-classlib', version: '0.8.1'
// https://mvnrepository.com/artifact/org.teavm/teavm-jso
implementation group: 'org.teavm', name: 'teavm-jso', version: '0.8.1'
// https://mvnrepository.com/artifact/org.teavm/teavm-tooling
implementation group: 'org.teavm', name: 'teavm-tooling', version: '0.8.1'
// https://mvnrepository.com/artifact/org.teavm/teavm-junit
testImplementation group: 'org.teavm', name: 'teavm-junit', version: '0.8.1'
}
Screenshot 2023-06-19 154211.png
Reply all
Reply to author
Forward
0 new messages