How to properly use TeaVMRunner? #1126
Replies: 2 comments 4 replies
-
It's not possible. TeaVM does not work on per-class basis. You need to convert entire application, i.e. your class and all its dependencies.
No, you need either Gradle or Maven. You can also use TeaVMTool, but it's primarily for the case you are writing a plugin for another build system (e.g. sbt or bazel, etc.). So I suggest you to start with Gradle. You are not supposed to use TeaVMRunner
Perhaps you don't provide all necessary jar files to
Oh, I just realized that TeaVMRunner does not support an option to generate Wasm GC.
Please, stop doing this. If you want to start using TeaVM, you can read this: https://teavm.org/docs/intro/getting-started.html |
Beta Was this translation helpful? Give feedback.
-
I apologize, by simple class file I meant that the whole application is just a single class file, with no or minimal imports. I would like to have a self contained But now that I've gotten things generating with gradle, the normal way, a few questions: js {
addedToWebApp = false
}Or is generating standalone wasm not a supported use-case? (Based on the documentation so far I would guess this is the case, but I wanted to try my luck anyways.) Thank you! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to turn a simple java class (bytecode) file into a simple wasm-gc binary file; As far as I understand TeaVMRunner is the tool I need to use for this, but if not please point me in the correct direction;
I don't quite understand how to give it the parameters properly.
I am also not super familiar with the java world, so I apologise in advance.
At first I built it with the command in the readme (
./gradlew publishToMavenLocal), but then I'm not sure why java does not pick it up from the classpath automaticallyThen I tried running it with just IntelliJ IDEA, which after some fiddling worked
(I needed to comment out the lines renaming the apache commons cli utils in settings.gradle.kts, otherwise it would not build
)
But with it building, I cannot figure out how to properly give it the correct parameters.
In the IntelliJ run configuration, I tried giving it various options:
--targetdir /mnt/cupcake/Projects/teavm/output/fannkuch -t wasm --classpath /mnt/cupcake/Projects/fannkuch-redux-javat/out/production/fannkuch-redux-java/ --entry-point main com.example.fannkuchreduxThe help text says that I need a qualified main class
usage: java org.teavm.cli.TeaVMRunner [OPTIONS] [qualified.main.Class]and as far as I understand
com.example.fannkuchreduxshould be it, however I'm not sure how that is supposed to be picked up, I assume from the CLASSPATH, thats why I also included the--classpathoption pointing it to where the class file that I want to turn into wasm is.I also included that same directory in the project classpath in the IntelliJ run configuration, to be sure, but no dice :(
I also tried
_startas the entry-point.The main error I get is:
I'd appreciate some pointers towards the right direction, and to know what exactly I'm doing wrong.
Beta Was this translation helpful? Give feedback.
All reactions