Maja Piechotka
Maja Piechotka

Reputation: 7216

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 language?

Upvotes: 2

Views: 439

Answers (1)

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.

Upvotes: 5

Related Questions