Fork me on GitHub

A transpiler from Java to TypeScript/JavaScript

1000+ well-typed JavaScript libraries available from Java

Version 1.1.0

Try it live » Quick start »


package animation;
[...] // imports
/** This program rotates the JSweet logo: try it by clicking on the logo! */
public class RotateLogo {

	public static void main(String[] args) {
		HTMLImageElement image = (HTMLImageElement) document.getElementById("logo");
		image.addEventListener(mousedown, RotateLogo::animate);

	static private double angle = 0;

	static private double animate(MouseEvent mouseEvent) {
		((HTMLElement) = "scale(" + Math.cos(angle) + ",1)";
		return window.requestAnimationFrame(time -> {
			angle = angle >= Math.PI * 2 ? 0 : angle + 0.05;
			if (angle != 0) {

… to JavaScript See TypeScript output

var animation;
(function (animation) {
	/** This program rotates the JSweet logo: try it by clicking on the logo! */
	var RotateLogo = (function () {
		function RotateLogo() {
		RotateLogo.main = function (args) {
			var image = document.getElementById("logo");
			image.addEventListener("mousedown", function (mouseEvent) { return RotateLogo.animate(mouseEvent); });
		RotateLogo.animate = function (mouseEvent) { = "scale(" + Math.cos(RotateLogo.angle) + ",1)";
			return window.requestAnimationFrame(function (time) {
				RotateLogo.angle = RotateLogo.angle >= Math.PI * 2 ? 0 : RotateLogo.angle + 0.05;
				if ((RotateLogo.angle != 0)) {
		RotateLogo.angle = 0;
		return RotateLogo;
	animation.RotateLogo = RotateLogo;
})(animation || (animation = {}));

JSweet leverages TypeScript to bring you the safest and most well-typed way to program JavaScript applications using the Java language and tooling. With our Maven repository, you get instant access to hundreds of well-typed JavaScript libraries in Java, daily-built from the TypeScript community typings.

Features and comparison

GWT/Vaadin DukeScript JSweet
Design / approach Framework Java VM on JavaScript Transpiler
Object oriented and well-typed
JavaScript output
(In-browser Java VM)
TypeScript output
Available well-typed JS libraries
0 (SDK)

1 (SDK + Knockoutjs)

>1000 (here)
Typing source In-house In-house TypeScript’s DefinitelyTyped community
Access to legacy Java code and APIs


(limited, see J4TS)
Reversible to simple TS/JS
Off-the-shelf Node.js support
Code execution Client+server Client Client+server (with Node.js)
Native in-browser Java debugging
(less native)

(not native)


Eclipse integration: the call hierarchy view example.


Debuging Java code right into the browser (or in Eclipse using SDBG).


Getting started

Learn how to use JSweet with Maven, install the Eclipse plugin and write your first JSweet programs. See how to use the Java language and all the associated tools to program WEB and Mobile HTML5 applications using existing JavaScript APIs and frameworks.

Start the tutorial »


Learn by example. Go to the examples page and check out many small JSweet-powered WEB apps, which can be forked on Github. See how to use JavaScript APIs, jQuery, Angularjs, Knockoutjs, Threejs, Nodejs, and many others from Java!

Go to examples »

APIs (candies)

JSweet APIs and libraries (a.k.a. candies) are generated through the most up-to-date TypeScript well-typed APIs on the Web. JSweet relies on the Definitely Typed definition files to create Java APIs for most of the JavaScript frameworks out there!

Go to candies »

Subscribe to JSweet news (low traffic)

Go to our blog.