TeaVM Works with Google Apps Script - Documentation Request #1077
Replies: 1 comment 6 replies
-
Why not the latest one?
Definitely not. There are plenty of possible use cases for TeaVM, I just can't cover/verify/document/maintain all of them. So I'd like to be somewhat decentralized. TeaVM is a compiler, and you can build whatever communities/projects that utilize it. However, I realize that it could be useful to have some centralized place where users could share their ideas, but being engineer person, not marketing person, I have neither idea how to do it, nor any willingness and time for it.
Not sure it will work with 0.10: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
TeaVM Works with Google Apps Script - Documentation Request
Summary
I've successfully tested TeaVM 0.10.2 with Java 21 in Google Apps Script environment and found it works well. Since this integration doesn't appear to be documented. It should be documented because otherwise general google search doesn't reveal anything, and if you ask Claude or any AI ... they simply tell it won't work.
So I wanted to share the working configuration here in the dicussions for the search engines to pick up if anybody tries to look for this, and wanted to request if some mention of this could be added in the official documentation (just a single line something which says that teavm works inside google appscript environment, and perhaps point to this dicussion thread).
Environment Tested (standard - nothing special)
What Works
Java Code Example (standard Teavm approach - nothing special)
JSO Interface Example (standard Teavm approach - nothing special)
These are just some samples, for making things work you will have to create all required class definitions for mapping to the GAS apis.
IMPORTANT : Google Apps Script Integration
This is simple, but this is the only extra configuration you need to do to make it work. The following needs be added in Code.js (Code.gs) as GAS is slightly different from browser environment. Without this exported teavm modules/functions will not be accessible to GAS functions.
If anyone needs more details about the implementation or have questions about the integration, I'm happy to provide additional information.
Thank You
Thanks to @konsoletyper I have full java/jvm stack for "everything", I don't need to go anywhere else. TeaVM successfully bridges Java and JavaScript environments, including Google Apps Script. Few years ago I used to use jsweet but it was kind of cumbersome, teavm is very clear and powerful. The fact that it has the ability to use Java 21 features is more than I can ask for (even jdk25 doesn't have any extraordinary new language feature that i need to be bothered about).
(Edit: the jso examples were ai-extracts of the code i tested, and it was slightly wrong, corrected it)
Beta Was this translation helpful? Give feedback.
All reactions