Sign in to follow this  
mrcriminy

[java] JNI alternatives?

Recommended Posts

mrcriminy    100
I have heard nothing positive about the java native interface. I am curious about alternative libraries or even other VM implementations that allow easily managed executions of input Java code in C or C++? EDIT: for grammer/speeeeling

Share this post


Link to post
Share on other sites
mrcriminy    100
Brutal, thank you.

I googled everything under the sun (no pun intended) except for that.

Also, I would like to actually hear some input on those, since a few links are dead and some are linked to commercial products (I'm not sure if those are a possibility).

I am a bit more interested in having an embedded JVM that can compile to bytecode/run user input code. I wanted to keep my initial post short until a dialogue could be established on possible choices and I could get human input on JNI.

It seems as if JNI and it's wrappers are more about interfacing static Java with static C++.

EDIT: I understand now, static Java loaded by JNI loads user input Java into the JVM. I just hope there is good error reporting x.x.

[Edited by - mrcriminy on April 21, 2008 4:07:55 PM]

Share this post


Link to post
Share on other sites
Antheus    2409
Quote:
Original post by mrcriminy

I am a bit more interested in having an embedded JVM that can compile to bytecode/run user input code.


JVM can't compile anything. It's a virtual machine, not a compiler. There exist compilers which generate Java byte-code from certain source code.

Quote:
It seems as if JNI and it's wrappers are more about interfacing static Java with static C++.


JNI is an interface that describes how C/C++ code can access JVM run-time environment.

Quote:
EDIT: I understand now, static Java loaded by JNI loads user input Java into the JVM. I just hope there is good error reporting x.x.


JVM runs byte-code and nothing more. There is no static Java, whatever that is supposed to mean. Certain members can be declared as static, but that's a Java or C/C++ language feature.

Error reporting is very trivial. A class either loads or it doesn't. If it loads, it means it passed the byte-code verifier and is valid. Otherwise it doesn't load.

If what you're thinking is using JVM as scripting engine, then there's things like BeanShell.


A much better approach would be to describe what you're trying to do.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this