Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclear whether Erjang can interface with Java code, e.g. Android UI #63

Closed
mcandre opened this issue Feb 11, 2013 · 1 comment
Closed

Comments

@mcandre
Copy link

mcandre commented Feb 11, 2013

Can Erjang call Java code?

Can Erjang be used to write Android apps?

@krestenkrab
Copy link
Contributor

Yes, Erjang can call Java code; syntax like:

foo() ->
    'java.lang.System':'gc'();

lets you call static Java methods. Returned objects can pose as Erlang terms. E.g. if it implements java.util.List, then it can pose as an Erlang list (i.e. you can match/deconstruct it). See more here: http://www.javalimit.com/2010/06/a-java-api-for-erjang.html

Currently, you cannot use Erjang to write Android apps; but it might not be totally undoable. Erjang has a byte code interpreter (use command line +i) which disables the to-JVM-bytecode-JIT, and this should in principle allow us to run apps on Android; but it has never been tried and there are probably a handful of classes that are being dynamically generated that could have been statically generated. Problem with Android is that dynamic code generation (JVM code) cannot be depended upon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants