Skip to content
This repository

A JVM-based Erlang VM

Octocat-spinner-32 .externalToolBuilders calling Kilim weaver in Eclipse build, so weaving is also done from w… April 14, 2012
Octocat-spinner-32 doc Add doc: February 04, 2014
Octocat-spinner-32 jnif Complete the NIF API to 100% October 24, 2013
Octocat-spinner-32 lib Updated kilim.jar November 28, 2013
Octocat-spinner-32 src Implement is_record/{2,3} BIFs April 07, 2014
Octocat-spinner-32 test_server Misc cleanup November 08, 2013
Octocat-spinner-32 triq Include triq (for test purposes) September 01, 2013
Octocat-spinner-32 .classpath Fix class names in jar files w/new kilim August 16, 2013
Octocat-spinner-32 .gitignore gitignore: Add IntelliJ-related file patterns. January 20, 2014
Octocat-spinner-32 .project calling Kilim weaver in Eclipse build, so weaving is also done from w… April 14, 2012
Octocat-spinner-32 .travis.yml Update test/build September 02, 2013
Octocat-spinner-32 LICENSE more license stuff November 09, 2009
Octocat-spinner-32 NOTICE A clone of Basho's erlang_js driver based on Mozilla Rhino. June 16, 2010
Octocat-spinner-32 OTP.launch - renamed Eclipse project from erlang to erjang September 22, 2011
Octocat-spinner-32 Adjust logo size on github September 06, 2013
Octocat-spinner-32 build.xml Use new Kilim optimize_codesize option October 07, 2013
Octocat-spinner-32 ej.bat erl tests are now running in ej and compared with erl January 07, 2011
Octocat-spinner-32 ejc cleaned up ejc starter April 14, 2012
Octocat-spinner-32 env_cfg Environment (and other) configuration has been reworked; Erjang now u… November 28, 2010
Octocat-spinner-32 clean up test build September 01, 2013
Octocat-spinner-32 erjang_logo4.png Create simple script to run the ERLConsole application. June 08, 2010
Octocat-spinner-32 erl.cmd bumped version to 0.2 April 14, 2012
Octocat-spinner-32 bumped version to 0.2 April 14, 2012
Octocat-spinner-32 jerl Rename main script ej -> jerl November 29, 2013
Octocat-spinner-32 in run_erl_tests always erlc first February 28, 2010
Octocat-spinner-32 weave.xml calling Kilim weaver in Eclipse build, so weaving is also done from w… April 14, 2012

Welcome to Erjang!

Build Status

Erjang is a virtual machine for Erlang, which runs on Java 7.


> ant alljar

      [jar] Building jar: erjang-R16B01.jar

Total time: 20 seconds

Then, just run java -jar erjang-R16B01.jar

How does it work?

It loads Erlang's binary .beam file format, compiles it into Java's .class file format, and loads it into the JVM. It will eventually have it's own implementation of all Erlang's BIFs (built-in-functions) written in Java.

Does it work?

Yes! It does actually work.

  • It can boot Erlang/OTP to the Eshell (ej command).
  • There's a GUI console (ejc command) which supports ^G and line editing. The console still needs some work [Swing wizards welcome here].
  • Run Erlang distribution, tcp/ip, port commands (stdio to external processes).
  • You can run the compiler (c(foo) command in the prompt)
  • It runs mnesia with distribution across Erjang/BEAM nodes.
  • The HTTP packet parsers are in the tcp/ip stack, so mochiweb and webmachine can run (without crypto for now).
  • Larger systems like rabbitmq and riak can boot; and works for basic cases ... but it's not ready for prime time yet.
  • Etc. etc. Lot's of stuff work.
> java -jar erjang-R16B01.jar
** Erjang R16B01 **  [root:/Users/krab/erlang/r16b01] [erts:5.10.2] [unicode]
Eshell V5.10.2  (abort with ^G)
1> 2+3.
2> 1/0.
** exception error: an error occurred when evaluating an arithmetic expression
     in operator  '/'/2
        called as 1 / 0
     in call from apply/3 
     in call from shell:apply_fun/3 (shell.erl, line 883)
     in call from erl_eval:do_apply/6 (erl_eval.erl, line 573)
     in call from shell:exprs/7 (shell.erl, line 674)
     in call from shell:eval_exprs/7 (shell.erl, line 629)
     in call from shell:eval_loop/3 (shell.erl, line 614)
     in call from apply/3 

There are still things that doesn't work: There are BIFs missing, or only partially implemented; we're quite careful to throw erjang.NotImplemented in BIFs (or branches thereof) which are not complete. Many OTP modules need NIFs or linked-in drivers that are entirely missing or only partly implemented. We do have experimental support for NIFs, so that may be improving soon.

What will it feel like to be running Erlang on the JVM?

Here is what to expect:

  • In Erjang, every node runs on a single heap, and so global GC will sometimes happen.
  • On the other hand, Erjang does not copy messages between processes -- they are simply shared, so sending large messages is significantly cheaper.
  • Over all, you will loose the predictability in behavior that Erlang has with regard to GC pauses, because Erlang can GC each process individually. Java GC continues to improve, so this might become less of an issue over time; but it will likely never go away.
  • My current tests indicate, that you can get better throughput in Erjang than BEAM, see this blog post, the graphs from google charts broke.
  • Erjang can run the "ring problem" at-par with BEAM, the Erlang virtual machine. If you let the JIT warm up, Erjang looks like it is faster than beam.
  • The big win is that Erjang is running on a VM that does dynamic compilation, selective inlining, and all the performance that comes from that.


You should be able to do ant jar. You need Perl version 5.10 or later, or you'll be unable to build the interpreter.


The only configuration you really need is to have an plain-old erlang installed, then Erjang will pick up the beam files using the $PATH to locate the erl binary, and then infer location of the beam files from there. For instance when booting ej

** Erjang R16B01 **  [root:/Users/krab/erlang/r16b01] [erts:5.10.2] [unicode]
Eshell V5.10.2  (abort with ^G)

You can see that it picked up the root from /Users/krab/erlang/r16b01. Alternatively you can pass an explicit -root /some/path to point erjang to a specific alternative erlang root.


When running, it writes files named ~/.erjang/${module}-${CRC}.jar. Each of these contain the JVM equivalent of an erlang module loaded into Erjang.

These files also serve as a cache of files translated from beam -> jar. If something goes astray, it may help to remove the ~/.erjang directory forcing Erjang to recompile next time it runs.


Kresten Krab Thorup krab at trifork dot com

Something went wrong with that request. Please try again.