HNHacker News
TopNewBestAskShowJobs

TeaVMFan

409 karma · joined October 10, 2019

submissionscomments
TeaVMFan··on Show HN: Blueprint: Fast, Nunjucks-like templating engine for Java 8 and beyond
If you're interested in Java template engines for the client side (SPAs), you can look at Flavour: https://flavour.sourceforge.io/

While templates are a big part of Flavour, it also includes routing, components, and idiomatic invocation of Java services.

The book on Flavour is here: https://frequal.com/Flavour/book.html

Example 5-letter word game single-page app made with 100% Java, 100% Flavour: https://frequal.com/wordii/

TeaVMFan··on Maintaining Weight Loss
For the "logging" step, I created and rely on CalorieFreq, a local-first Java SPA:

https://frequal.com/cf/

It is built on the Flavour framework:

https://flavour.sf.net

TeaVMFan··on Fast Java Web Front-ends: Flavour 0.3.2 released
Flavour 0.3.2 is now live on Maven Central. It includes these enhancements:

* Routing enhancements for Dates (contributed by linuxfun) * The archetype has been updated with support for routing and deep linking. (The old archetype is now archetype-minimal, still useful for projects that don't need routing.)

For more information on Flavour:

* Flavour Book: https://frequal.com/Flavour/book.html * Flavour Home Page: https://flavour.sf.net/

TeaVMFan··on Flavour 0.3.1 Java SPA Framework: Routing, Component, and Archetype Enhancements
Flavour 0.3.1 is now live on Maven Central. It includes these enhancements:

* Ticket #11 is resolved: Spaces are allowed in path parameters

* Ticket #3 is resolved: Fixed vague error message for missing setter in html:bidir-value

* Fixed archetype to hide static message after startup

For more information on Flavour:

* Flavour Book: https://frequal.com/Flavour/book.html

* Flavour Home Page: https://flavour.sf.net/

TeaVMFan··on I used AI-powered calorie counting apps, and they were even worse than expected
I prefer efficient manual entry to vibe-coding calories. I built my own Java-based SPA: https://frequal.com/cf/

It's local-first so you control this sensitive information. It features easy reuse and exercise tracking.

TeaVMFan··on Stringly Typed
This is one of my favorite things about the Flavour framework: strongly-typed web service calls:

https://frequal.com/Flavour/book.html#org44d6b49

Your single-page app code calls your backend API using strong types. Your code is clean and the framework handles marshaling and unmarshalling JSON.

TeaVMFan··on Giving Software Away for Free
Yes, Flavour apps are an index.html file and a classes.js file (plus optional CSS, images, etc. as desired). So with as few as 2 static files you can serve up a Java-based modern web app in a web browser.

For example, try Wordii, a 5-letter word game here: https://frequal.com/wordii/

If you look in the network tab, you can see it is loaded as a small HTML page, a classes.js file, and a few CSS files. All of those are served as simple static resources.

More information on how Wordii was created: https://frequal.com/java/MakingWordiiAPureJavaSpa.html

TeaVMFan··on Giving Software Away for Free
For the Java crowd, a similar tool to build real, modern single page apps in Java is Flavour:

https://frequal.com/Flavour/book.html

TeaVMFan··on Browsercraft: Java Minecraft in the browser
+1 for Eaglercraft. It's based on the open source TeaVM project ( https://teavm.org/ ), which transpiles Java to JS or WASM to run efficiently in modern browsers. With numerous shipped production Java-in-the-browser projects, TeaVM is my preferred option for Java in the browser thanks to its performance, build speed, and Apache license.
TeaVMFan··on TL;DW: Too Long; Didn't Watch Distill YouTube Videos to the Relevant Information
1 in base 42.
TeaVMFan··on Why Blog If Nobody Reads It?
I blog on technical topics as a reminder to my future self. I increasingly find myself needing the details of some command line or process from long ago, and having my own notes easily searchable is a great time saver. Hopefully it helps someone else too.
TeaVMFan··on New Java to WASM GC Transpiler: Run Java in the Browser, No Plugin Required
True, WASM adoption is still low and could feasibly be removed, but TeaVM lets you target both JavaScript and WASM GC backends, so you are future proofed either way.
TeaVMFan··on New Java to WASM GC Transpiler: Run Java in the Browser, No Plugin Required
+1 for for Codename One. It is the only tool I use when I need a mobile-only app. I have built numerous apps using Codename One, and have released 2 of them in app stores. Great Swing-like API, great examples, great documentation.
TeaVMFan··on New Java to WASM GC Transpiler: Run Java in the Browser, No Plugin Required
The in-browser H2 database is very cool, thanks for sharing. I'm a regular user of H2, but have only used it server-side so far.

How much trouble was it to get working? Not sure how doppio handles the absence of raw TCP connections and a standard filesystem in the browser, but if it works in doppio I would think it could work in TeaVM too.

TeaVMFan··on New Java to WASM GC Transpiler: Run Java in the Browser, No Plugin Required
True, but are people turning off ECMAScript/WASM in their browsers to avoid this? As an app developer, I want to know if my app will keep running. In the Java Applet days, at some point the security scares became frequent enough to cause articles like "Turn off Java except on websites where you are actively using it". Once your users have to find and toggle a setting to make your app work, your audience size drops significantly.

I don't see such fears around ECMAScript/WASM. Since the dominant players have a vested interest in users feeling safe leaving those technologies turned on for all websites, they'll keep investing to maintain that safety (and the marketing of that safety).

This is a massive insurance policy for building a TeaVM app -- the foundational web technologies it builds on are receiving incredible investments from industry heavyweights. It's not just security that is maintained, new Web APIs are regularly developed too. Want to use USB from your web app? No need to wait for Oracle to roll out a Java API for it -- browser vendors have made a new API and you can call it from you TeaVM app right away.

TeaVMFan··on New Java to WASM GC Transpiler: Run Java in the Browser, No Plugin Required
To me, this is one of the many ingenious things about TeaVM's architecture. By using the preferred code execution mechanisms of browser vendors (WASM and ECMAScript, plus Web APIs) to deliver Java code, it ensures they can't block or shut down this delivery mechanism. They would have to cut off their noses to spite their faces.

Furthermore, since the browser vendors never want browser code to have public security issues, they work hard to find and fix problems in their sandboxes and runtimes. This of course benefits TeaVM apps as well, since they play in those same sandboxes, and gives them a level playing field with other web apps in perpetuity.

Plugin-based applets were only safe as long as Sun had clout and the browser vendors were investing less in security than the Java team.

TeaVMFan··on New Java to WASM GC Transpiler: Run Java in the Browser, No Plugin Required
Vaadin has a restrictive, commercial license.

By contrast, TeaVM is Apache-licensed, available for commercial use without any gotchas, limits, or entanglements.

TeaVMFan··on New Java to WASM GC Transpiler: Run Java in the Browser, No Plugin Required
Here are over a dozen TeaVM-based projects, for inspiration: https://www.frequal.com/TeaVM/TeaVmBasedSites.html

Several use cases where TeaVM shines:

* A developer or team has strong Java skills and wants to develop single-page apps

* A Java desktop project wants to move to the web and has lots of validation logic they don't want to double-maintain in Java and ECMAScript/WASM

* A Java-based game developer wants to make a Canvas-based version of their game for the web (potentially full-screen)

* A Java developer wants a batteries-included framework for web development. TeaVM comes with a minifier, tree-shaker, packager, and more, out of the box, with familiar 'mvn clean install' semantics (And Gradle support too).

For more details on use cases and reasons for picking TeaVM, read chapter 1 of my book here: https://frequal.com/Flavour/book.html

TeaVMFan··on New Java to WASM GC Transpiler: Run Java in the Browser, No Plugin Required
No Swing support at present. There is an issue filed, but it is in need of an implementer: https://github.com/konsoletyper/teavm/issues/406

I made a general guide for migrating from Swing to TeaVM here: https://frequal.com/TeaVM/migration/MigratingFromSwingToTeaV...

For a more specific example, I ported an open-source Java applet and described the process here: https://frequal.com/java/RestoringA19YearOldGameWithTeaVm.ht...

TeaVMFan··on New Java to WASM GC Transpiler: Run Java in the Browser, No Plugin Required
The new release of TeaVM (0.11.0) now supports WebAssembly GC. This increases performance while further decoupling TeaVM apps from ECMAScript.

TeaVM ( https://teavm.org/ ) is an Apache-licensed project, free for use in commercial projects. It is mature and used widely, including in frameworks like Flavour ( https://frequal.com/Flavour/book.html ) and more projects listed here: https://www.frequal.com/TeaVM/TeaVmBasedSites.html

TeaVM compiles Java code to run in the browser, efficiently and quickly. It features short build times, small downloadable files, and a batteries-included toolset (including minification, tree-shaking, and packaging). Previous releases have conquered all similar open-source tools (that support threading) in independent testing: https://renato.athaydes.com/posts/comparing-jvm-alternatives...

TeaVMFan··on If not React, then what?
If Java is your cup of tea, you might want to try Flavour. I did and now it's the only frontend framework I use. https://flavour.sourceforge.io/

It lets you write your frontend and backend code in the same language, even sharing models and validation logic so refactorings work full stack.

You get strong typing and a rich SPA framework that includes routing, templates, and easy server calls.

There's a book ( https://frequal.com/Flavour/book.html ) and a Java SwingSet-like app with live demos and source code called Tea Sampler ( https://frequal.com/tea-sampler/ ).

TeaVMFan··on Mill: A fast JVM build tool for Java and Scala
It's great to see continuing innovation in the Java space!

One tool I've been using to speed up maven is mvnd, the maven daemon. It's a drop in replacement for mvn with impressive speedups.

https://github.com/apache/maven-mvnd

TeaVMFan··on React on the server is not PHP
If you prefer your full-stack development in Java, definitely check out Flavour. It gives you the benefits this article claims to want but without the weakly-typed languages and all of their attendant footguns:

Flavour book: https://frequal.com/Flavour/book.html

TeaVMFan··on Show HN: I Wrote a Book on Java
Flavour supports multiple JVM languages. Plus it is a batteries-included framework, no need to look to extensions to get routing, templates, EL, JAX-RS support, and more.
TeaVMFan··on Show HN: I Wrote a Book on Java
Congratulations! In case people are looking for other modern Java books, here's one I'm working for building modern web apps in Java:

https://frequal.com/Flavour/book.html

It describes how to make single-page apps in Java, using the Flavour framework. No plugins, no extensions, and 99.9% pure Java. Plenty of sample code and links to relevant podcast episodes and demos.

TeaVMFan··on Oracle, it's time to free JavaScript
With TeaVM you can compile Java to JavaScript and run it in the browser again. We've come full circle. https://teavm.org/
TeaVMFan··on Nothing: Simply Do Nothing
Intriguing. Perhaps adding focus gained detection with a timer reset would increase the motivation to do nothing.
TeaVMFan··on Why is language documentation still so terrible?
I can vouch for the quality of the Java documentation. Having learned Java primarily from the online javadoc pages, the Sun Java Tutorial, and Java in a Nutshell, I think the Java documentation really set the bar high.
TeaVMFan··on Home to Anything JavaFX Related
This is impressive work, snappier than most of the "compile a rich Java GUI to js" systems out there, which can take minutes to start up -- an eternity on the web.

While I've used JavaFX on non-trivial projects, the momentum for UX definition seems to have swung towards HTML/CSS. To combine HTML/CSS layout with Java frontend logic, I have switched to Flavour ( https://flavour.sourceforge.io/ ) for all my new projects. (Disclaimer: while I didn't create Flavour, I'm now the maintainer.)

Flavour lets you make fast-downloading single-page apps, like Wordii ( https://frequal.com/wordii/ ). It's easy to get started, there's a maven archetype and easy instructions at https://flavour.sourceforge.io/. Much more documentation is in the Flavour book: https://frequal.com/Flavour/book.html

TeaVMFan··on UI elements with a hand-drawn, sketchy look
NapkinLAF provided a hand-drawn look for Swing:

https://napkinlaf.sourceforge.net/#Snapshots

← PreviousPage 3 of 6Next →