4 ms·
This uses TeaVM to compile Java to JavaScript. Launches faster in browser than the desktop (once cached). Download is 1.2mb (compressed) - much smaller than des
by jeffreportmill1 8y ago
This uses TeaVM to compile Java to JavaScript. Launches faster in browser than the desktop (once cached). Download is 1.2mb (compressed) - much smaller than desktop version. Runtime speed seems the same as desktop.
http://teavm.org http://teavm.org
- Klathmon 8y agoThose are some incredible stats! Do you have any insight or ideas on where the performance increases and size decreases are coming from? Also, did you have to work a lot to get it working in TeaVM? The last I looked at it (which was admittedly over a year ago), it still required some non-trivial changes for the Java app I was working with at the time.
- jeffreportmill1 8y agoI think the big win is that TeaVM has a lighter runtime and conditionally compiles only what is needed into the final JavaScript. There are tools that let Java do this now, but I think the standard runtime has more cross dependencies. My app cross compiles to JVM and browser easily now, but I did a lot of work on the SnapKit UI framework, which is like Swing but abstracts out graphics and user input. My app used to be all Swing - that would be almost impossible with TeaVM. There is product called CheerpJ which does Swing with almost no modification, but it has a larger runtime.
- soulnothing 8y agoIs this using JavaFX or the the noted framework Flavour from teavm?
- jeffreportmill1 8y agoI use something called SnapKit (available on GitHub). It's like Swing and JavaFX had a baby, except that it has an abstraction layer that lets it compile to either JVM or JavaScript.
- alok-g 8y agoThis sounded interesting, till I foundd that it is only for iOS and OS X. Am I looking at the right thing? :-)
- jeffreportmill1 8y agoNope - it works everywhere: https://github.com/reportmill/SnapKit https://github.com/reportmill/SnapKit
- alok-g 8y agoSounds interesting still. No license is specified though.
- stewbrew 8y agoThis means you're dependent on 1 developer who still wants to maintain this software? That said: (IMHO) impressing demo.
- jeffreportmill1 8y agoThere are a few people working on similar projects, which I can use if absolutely needed (CheerpJ, JSweet). But you're right. It makes me sad that Oracle doesn't do something like this - ideally by bringing some of these people in.
- matt2000 8y agoI think it actually uses "Cheerpj"? Or at least it's listed as one of the demos: https://www.leaningtech.com/cheerpj/demos/ https://www.leaningtech.com/cheerpj/demos/
- jeffreportmill1 8y agoI've done both CheerpJ and TeaVM. CheerpJ is awesome - it's a complete port of the JVM to JS and apps often work with no modification. However, the app + runtime is about 75mb (uncompressed) and can take minutes to load from a cold start. This post links to the TeaVM version. TeaVM is also awesome - but it has a reduced runtime, conditional compilation and better built-in DOM support. The whole app + runtime is 1.2mb (compressed) and loads in seconds (instantly once cached).
- arendtio 8y ago> compile Java to JavaScript If we would travel back in time to the nineties and tell them we have technology that compiles Java to JavaScript they would put us straight to a psychiatric hospital :D
- debaserab2 8y agoThe technology has been around for over ten years - I believe Google Web Toolkit (GWT) was available in the mid 2000's, which also compiles Java source to Javascript.
- gcb0 8y agoDon't think it was a jvm though, more like a cross-compiler.
- deleted 8y ago[deleted]
- macspoofing 8y agoGWT is a little different in that it didn't use HTML Canvas to render the UI, but rather the DOM.
- pklee 8y agoI believe the GWT was aimed at AWT rendered on the web and I am also not sure it was "compiling" it as much as it was translating it.
- javajosh 8y agoThe first statement is false. GWT defines it's own widgets, not AWT or Swing. The second statement is true - GWT is a transpiler. It would be very interesting if GWT could operate on bytecode but that's probably a very different project.