{"id":13694752,"url":"https://github.com/trifork/erjang","last_synced_at":"2026-01-11T03:49:37.364Z","repository":{"id":719500,"uuid":"366720","full_name":"trifork/erjang","owner":"trifork","description":"A JVM-based Erlang VM","archived":false,"fork":false,"pushed_at":"2018-03-29T14:09:37.000Z","size":29601,"stargazers_count":726,"open_issues_count":31,"forks_count":62,"subscribers_count":44,"default_branch":"master","last_synced_at":"2024-11-12T21:39:12.570Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.erjang.org","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trifork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-11-09T20:36:06.000Z","updated_at":"2024-11-04T14:32:58.000Z","dependencies_parsed_at":"2022-07-07T15:08:25.240Z","dependency_job_id":null,"html_url":"https://github.com/trifork/erjang","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trifork%2Ferjang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trifork%2Ferjang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trifork%2Ferjang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trifork%2Ferjang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trifork","download_url":"https://codeload.github.com/trifork/erjang/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252144468,"owners_count":21701418,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T17:01:40.371Z","updated_at":"2026-01-11T03:49:37.335Z","avatar_url":"https://github.com/trifork.png","language":"Java","readme":"\u003cimg src=\"https://raw.github.com/trifork/erjang/master/erjang_logo4.png\" width=\"96px\" align=\"right\"\u003e\n\n# Welcome to Erjang!  \n\n[![Build Status](https://travis-ci.org/trifork/erjang.png)](https://travis-ci.org/trifork/erjang) \n\nErjang is a virtual machine for Erlang, which runs on Java 7.  \n\n* For comments and questions please use the [Erjang Google Group](http://groups.google.com/group/erjang)\n* Check the [README](https://github.com/trifork/erjang/wiki/README) before you try to run this.\n* I am also occasionally posting updates at my blog, [Java Limit](http://javalimit.com)\n\n### Building...\n\n````\n\u003e ant alljar\n...\n\nalljar:\n      [jar] Building jar: erjang-R16B01.jar\n\nBUILD SUCCESSFUL\nTotal time: 20 seconds\n````\nThen, just run `java -jar erjang-R16B01.jar`\n\n### How does it work?\n\nIt 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.  \n\n### Does it work?\n\nYes!  It does actually work.\n\n- It can boot Erlang/OTP to the Eshell (`ej` command).\n- There's a GUI console (`ejc` command) which supports ^G and line editing.  The console still needs some work [Swing wizards welcome here].\n- Run Erlang distribution, tcp/ip, port commands (stdio to external processes).\n- You can run the compiler (`c(foo)` command in the prompt)\n- It runs `mnesia` with distribution across Erjang/BEAM nodes.\n- The HTTP packet parsers are in the tcp/ip stack, so `mochiweb` and `webmachine` can run (without crypto for now).\n- Larger systems like `rabbitmq` and `riak` can boot; and works for basic cases ... but it's not ready for prime time yet.\n- Etc. etc.  Lot's of stuff work.\n\n````erlang\n\u003e java -jar erjang-R16B01.jar\n** Erjang R16B01 **  [root:/Users/krab/erlang/r16b01] [erts:5.10.2] [unicode]\nEshell V5.10.2  (abort with ^G)\n1\u003e 2+3.\n5\n2\u003e 1/0.\n** exception error: an error occurred when evaluating an arithmetic expression\n     in operator  '/'/2\n        called as 1 / 0\n     in call from apply/3 \n     in call from shell:apply_fun/3 (shell.erl, line 883)\n     in call from erl_eval:do_apply/6 (erl_eval.erl, line 573)\n     in call from shell:exprs/7 (shell.erl, line 674)\n     in call from shell:eval_exprs/7 (shell.erl, line 629)\n     in call from shell:eval_loop/3 (shell.erl, line 614)\n     in call from apply/3 \n3\u003e\n````\n\nThere 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.\n\n\n\n### What will it feel like to be running Erlang on the JVM?\n\nHere is what to expect:\n\n* In Erjang, every node runs on a single heap, and so global GC will sometimes happen.\n* On the other hand, Erjang does not copy messages between processes -- they are simply shared, so sending large messages is significantly cheaper.\n* 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.\n* My current tests indicate, that you can get better throughput in Erjang than BEAM, see [this blog post](http://www.javalimit.com/2010/06/erjang-running-micro-benchmarks.html), the graphs from google charts broke.\n* 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.\n* 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.  \n\n\n## Building\n\nYou should be able to do `ant jar`.  You need Perl version 5.10 or later, or you'll be unable to build the interpreter.\n\n## Configuring\n\nThe 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`\n\n````\n./ej\n** Erjang R16B01 **  [root:/Users/krab/erlang/r16b01] [erts:5.10.2] [unicode]\nEshell V5.10.2  (abort with ^G)\n1\u003e \n````\n\nYou 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.\n\n\n## Running\n\nWhen running, it writes files named `~/.erjang/${module}-${CRC}.jar`.  Each of these contain the JVM equivalent of an erlang module loaded into Erjang.\n\nThese files also serve as a cache of files translated from beam -\u003e jar.\nIf something goes astray, it may help to remove the `~/.erjang` directory\nforcing Erjang to recompile next time it runs.\n\n\nCheers!\n\nKresten Krab Thorup\nkrab _at_ trifork dot com\n\n\n\n\n","funding_links":[],"categories":["Java","JVM语言","VI. Program languages and applications that were written with Java"],"sub_categories":["1.  Program languages that were written with Java"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrifork%2Ferjang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrifork%2Ferjang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrifork%2Ferjang/lists"}