Skip to content
SPECIFICTION
Get listed

J2ObjC vs js_of_ocaml

J2ObjC

developers.google.com

js_of_ocaml

ocsigen.org

Side by side

FigureJ2ObjCjs_of_ocaml
Price fromFreeFree
Free planYesYes
Free trial——
Open source——
Web—Yes
macOSYes—
LinuxYesYes
iOSYes—
API—Yes
Plans published11
Spec score · Code Transpilers7.8 (#14)8.4 (#5)
Build integrationThe j2objcc command-line script wraps clang and uses the iOS SDK, while Xcode projects need J2ObjC-specific linker settings.Dune supports js_of_ocaml natively and selects separate compilation in dev and whole-program compilation in release builds.
LibrariesThe distribution includes static libraries for Guava, JUnit, Mockito, Protocol Buffers, and other Java libraries or Android utility classes.The distribution includes packages for Lwt support, TyXML, JSON derivation, and running an OCaml toplevel in the browser.
RequirementsThe listed requirements are a Mac workstation or laptop, macOS 15 or higher, Xcode 16 or higher, and JDK 21 or higher.The documented compiler requirements include OCaml 4.13 to 5.5, Dune 3.20 or later, and Menhir.
SupportThe project points users to its issue tracker, Stack Overflow j2objc tag, and Google Groups discussions for help.The project asks users to report problems or questions through GitHub issues and include version details and a minimal reproducible example when possible.

Plans

J2ObjC

  • Free and open sourceFree

J2ObjC pricing →

js_of_ocaml

  • js_of_ocamlFree

js_of_ocaml pricing →

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.

Visit developers.google.com

js_of_ocaml

js_of_ocaml compiles OCaml bytecode programs into JavaScript for browsers and Node.js. It works with an existing OCaml installation and does not require libraries to be recompiled. Installation is available through opam, while Dune supports separate compilation in development and whole-program compilation in release builds. Whole-program compilation performs global dead-code elimination and cross-module optimization. The library provides a typed bridge between OCaml and JavaScript, including PPX syntax for properties, methods, constructors and objects. Browser bindings cover the DOM, Fetch, WebSockets, WebGL, workers and typed arrays. Optional packages add Lwt support, TyXML, JSON derivation and an OCaml toplevel in the browser. Documented targets include Node.js 18 or later, QuickJS-NG and modern ECMAScript 2020 browsers, including Chrome 80+, Firefox 74+, Safari 13.4+ and Edge 80+. Requirements include OCaml 4.13–5.5, Dune 3.20 or later and Menhir. The project is free and open source.

Visit ocsigen.org