using jni4net in c# to call java google speech to text api code

300 views
Skip to first unread message

Ruts Karyakarte

unread,
Sep 9, 2019, 6:12:24 AM9/9/19
to jni4net
Hi,

I am struggling to call java api code in c# using jni4net. 
Can someone throw some light on this topic please? 

Below are the steps I have taken so far. 
1. Written a  code in eclipse / maven. 
2. Created a jar file with all dependencies in it. 
3. Created .Net application in visual studio 2017 
4. included  jni4net dll and its jar file along with above generated jar file of google speech to text api.
(To do this step I am referring jni4net sample helloworldfromCLR)

Now the last step which I don't know how to do,  Is to call class/method from jar file in c# application to print speech to text results. 


I appreciate any help here. 
Thanks,
Ruta

Pavel Šavara

unread,
Sep 9, 2019, 6:19:30 AM9/9/19
to jni4net
Your java code needs to be represented in C# by some code, so that you could use it there.
That code is caled proxy. jni4net has proxygen  tool which could read your jar file and produce proxy code.
You will need to compile the proxy code and add it to your C# project as reference, so that you could use it.


--
--
You received this message because you are subscribed to jni...@googlegroups.com
http://groups.google.com/group/jni4net?hl=en-GB?hl=en-GB
http://jni4net.sf.net/

---
You received this message because you are subscribed to the Google Groups "jni4net" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jni4net+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/jni4net/bf265f96-42a7-471d-828c-704f124772f2%40googlegroups.com.

Ruts Karyakarte

unread,
Sep 9, 2019, 7:34:35 AM9/9/19
to jni4net
Hi,
Thanks a lot for your quick response. I am now looking at ProxyGen on link here https://github.com/jni4net/jni4net/wiki/ProxyGen .
I am still not sure what I suppose to do with ProxyGen.exe.  I can see ProxyGent.exe in bin folder. They are Proxygen.exe, proxygen.exe.config , proxygen-GPL.3.0.txt in bin folder. I also copied jni4net.j-0.8.8.0 jar and dll files there. 
Do I need to copy my java code's jar file there? Above link suggest below 

c:\users\you\desktop\proxygen.exe "c:\users\you\desktop\lib.dll" -wd "c:\users\you\desktop"

...and when generating Java proxies for a .NET-compiled library with dependencies, enter:

c:\users\you\desktop\proxygen.exe "c:\users\you\desktop\lib.dll" -wd "c:\users\you\desktop" -cp "c:\users\you\desktop\dependsA.dll","c:\users\you\desktop\dependsB.dll"
 
what is depends.dll and depends.dll, lib.dll?  I can not see any of them in my sample code.
Thanks,
Ruta
To unsubscribe from this group and stop receiving emails from it, send an email to jni...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages