Tag: Generate file copy 17. Import into the-O lips hint
Recently tried to use C # to do Nb_iot north to API interface access. North-to-API access requires two-way authentication of certificates, while C # does not support bidirectional authentication, so use IKVM to run Java programs in C # to implement the HTTPS request section.
The steps are as follows:
First, use Eclipse to write the north to the API to the Java part of the Code and packaging.
1. Code Writing
2. Generate Jar
3. Add the packages that are dependent on the project to the generated jar, because some dependent packages do not exist when the jar is generated, and it is convenient to add the dependency package to the jar in advance by using IKVMC to build the DLL one at a time without having to import the dependent packages in Ikvmc in turn.
Second, use IKVMC to generate the DLL, because the north of the API uses more than JDK8, so choose the ikvm-8.1.5717.0 version, the version supports JDK8
1. Copy the generated jar to Ikvm-8.1.5717.0\bin, use the command prompt to enter the directory, and use the Ikvmc-out:xx.dll Xx.jar command to generate the DLL.
Note: The use of the generated output can not be an error when the generation is unsuccessful, alarm information can be ignored according to the situation.
Third, the DLL will be generated with IKVM.Runtime.dll, IKVM. Runtime.JNI.dll, IKVM. OpenJDK.Core.dll copied to a C # project and referenced (PS: Copy the DLL directly here IKVM always reported that the file can not find the error, very tangled! I was able to add the corresponding version of IKVM through NuGet).
Write a program for C # and call it,
Run! Success!!!!
Java generates a jar and uses IKVM to generate DLLs for C # calls