0

There are few methods in a executable(c#) file which are entry points to the application, I want to access this methods directly from java, Is there any way I will be able to do that?, I don't want use JNI layer in between.Previously I created a .NET client to access exe and used JNI4NET to connect from java to .net, This layer I have to completely remove and make a connection to exe directly from java and Can I use proxygen against exe to create java native interfaces?

Yashwanth Potu
  • 346
  • 4
  • 19

1 Answers1

0

Run a new program with ProcessBuilder. You cannot modify arguments in any already running program, so terminate them first.

Cardinal System
  • 2,749
  • 3
  • 21
  • 42
  • Tried that,but I don't think using processbuilder we can access methods in executable file, Let me know if it is possible – Yashwanth Potu Apr 27 '17 at 23:10
  • @YashwanthPotu take a loot at [this](http://stackoverflow.com/questions/5604698/java-programming-call-an-exe-from-java-and-passing-parameters) – Cardinal System Apr 27 '17 at 23:12
  • Tried all this methods, at most we can send command line arguments, but cannot access methods – Yashwanth Potu Apr 27 '17 at 23:19
  • 1
    You can but it's a bit difficult. You can use a COM interface, for the java side you need to use a library to access COM objects like this: https://sourceforge.net/projects/jacob-project/ And on the .net side you must expose your COM objects: https://www.codeproject.com/Articles/3511/Exposing-NET-Components-to-COM – Gusman Apr 27 '17 at 23:24
  • .net objects can be exposed as COM objects, that's what the linked article explains how to do. – Gusman Apr 27 '17 at 23:28