Calling Java from C program
How to call Java methods from C program? I.e. is it possible to embed java (not necessary Sun/Oracle JVM) in other la开发者_StackOverflow中文版nguage?
A full Oracle JVM is a very large chunk to pull into your existing program, but it is perfectly doable but I would recommend against it if any of the following apply:
- You need to pull a lot of data in and out of the JVM on a frequent basis. This is expensive.
- You are not in full control of the operating system and JVM to use.
- You are not an experienced C programmer. Debugging these things can be hard.
You might find jamvm - http://jamvm.sourceforge.net/ - an interesting alternative. It is a very small interpreter written in C, which may be a lot easier to handle. I have not tried embedding it.
精彩评论