How to access Java SDK using C ++

I am currently working on a project that should be written in C ++, since the other part of the project is in C ++. However, I have to use the U-Prove SDK to complete my task. MS provides two kinds of SDKs, Java and C #. I am wondering if there is a way to access the SDK with C ++ code. So finally, I want a C ++ program (and not two separate programs) that can use the U-Prove SDK.

By the way, my English sucks, so if I can’t clarify anything, feel free to tell me. Thanks.

+4
source share
2 answers

Of course, I am not an authority in this regard, but I used JNI (Java Native Interface) for a great effect in the past. From Wikipedia article :

Native Java Interface (JNI) is a programming environment that allows Java code running on the Java Virtual Machine (JVM) to call and be called [1] native applications (programs specific to the hardware platform and operating system) and libraries written in other languages ​​such as C, C ++ and assembly.

I recommend this tutorial and this best practice guide. Here is a free book provided by Oracle , however it is a bit older than other material.

I suggest that you study JNI as a solution to a larger set of problems, determine where your problems correspond in terms of what JNI can do, and then focus on these areas.

+2
source

Are you going to use Native C ++ or managed C ++ CLR? If it is for the .NET / windows app. You can use IKVM. It could compile java code (source code or compiled byte code) into the MSIL .net library, then you can use it in your C ++ managed application

Please check out http://ikvm.net

+1
source

Source: https://habr.com/ru/post/1393666/


All Articles