J2ObjC vs JSweet
J2ObjC
developers.google.comJSweet
jsweet.orgSide by side
| Figure | J2ObjC | JSweet |
|---|---|---|
| Price from | Free | Free |
| Free plan | Yes | Yes |
| Free trial | — | — |
| Open source | — | Yes |
| Web | — | Yes |
| Windows | — | Yes |
| macOS | Yes | Yes |
| Linux | Yes | Yes |
| iOS | Yes | Yes |
| Android | — | Yes |
| API | — | Yes |
| Self-hosted | — | Yes |
| Plans published | 1 | 1 |
| Spec score · Code Transpilers | 7.8 (#14) | 8.7 (#1) |
| What it does | J2ObjC is an open-source command-line tool from Google that translates Java source code to Objective-C for iOS. | JSweet transpiles Java source into TypeScript and JavaScript for browser, mobile-webview and Node.js applications. |
Plans
In their own words
J2ObjC
J2ObjC is Google’s free, open-source command-line tool for translating Java source code into Objective-C for iOS. It is designed for sharing non-UI application logic and data models across web, Android, and iOS projects. Supported Java features include exceptions, inner and anonymous classes, generics, threads, and reflection, and the tool can translate and execute JUnit tests. The distribution contains static libraries for Guava, JUnit, Mockito, Protocol Buffers, and other Java or Android utility libraries. J2ObjC does not provide a platform-independent UI toolkit; iOS interfaces use Objective-C, Objective-C++, or Swift with Apple’s iOS SDK. Developers need source code they own or are licensed to use because Android binaries cannot be converted. Requirements include a Mac workstation, macOS 15 or higher, Xcode 16 or higher, and JDK 21 or higher. The j2objcc script wraps clang and uses the iOS SDK, while Xcode projects need J2ObjC linker settings. Objective-C reference counting leaves memory management to developers.
JSweet
JSweet converts Java programs into TypeScript and JavaScript for browsers, mobile Web views, or Node.js. It uses Oracle's Java compiler alongside Microsoft's TypeScript compiler to generate type-checked JavaScript. The project describes the output as regular JavaScript that can work directly with JavaScript programs and libraries. Listed language features include Java-to-TypeScript syntax mapping, Java constructs, async/await, and ECMAScript targets from ES3 to ES6. JSweet lists support for more than 1,000 JavaScript libraries, frameworks, and plugins, packaged as Maven artifacts called candies. It provides Eclipse, Maven, and Gradle plugins, and names Angular, Cordova, Node.js, and Three.js among example integrations. Generated programs can use CommonJS, AMD, or UMD modules and run in browsers or Node.js. A debug mode supports debugging Java code in a browser. Setup instructions call for Git, Node.js, and Maven, then use Maven to generate JavaScript from a quickstart project. JSweet is open source and free, and is presented for Java developers building web and mobile HTML5 applications with JavaScript libraries and frameworks.