Calling java (.jar) from C++?

G

Guest

Hi there,


I have a need to call a java database library from C++ applications. Can
anyone point me in the right direction on how to accomplish this?

Thanks.
 
G

Guest

cada0310 said:
I have a need to call a java database library from C++ applications. Can
anyone point me in the right direction on how to accomplish this?

I think you would be better off using something like ODBC, ADO .NET, etc.,
to access the underlying database directly if you have any choice in the
matter.

Is there some particular reason you must use the Java interface with the C++
app?

Sean
 
C

Carl Daniel [VC++ MVP]

cada0310 said:
Hi there,


I have a need to call a java database library from C++ applications. Can
anyone point me in the right direction on how to accomplish this?

You need to host the JVM in your application and use the JVM hosting
interfaces to access the Java library. Search the Sun Java site for
information about hosting the JVM.

As another respondent already pointed out, there's likely a better way to
accomplish what you need, but the Java interface library is your only
choice, JVM hosting is what you need.

-cd
 
J

jacky kwok

cada0310 said:
Hi there,


I have a need to call a java database library from C++ applications. Can
anyone point me in the right direction on how to accomplish this?

Thanks.


1. using Java Native Interface (JNI)
refer
http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/jniTOC.html

However, it will be complex and painful task.


2. if you use C++ in Dotnet (managed C++), you can try the
Javaimplementation in Dotnet - IKVM.

refer "http://www.ikvm.net/"

If lucky, you can convert the java library to a Dotnet assembly and call
it as normal Dotent library.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top