1

Our java program is suppose to call a program created by our vendor in C#. We are given two files

1.An exe file

2.An xml file...which its contents go something like this

<doc>
  <assembly><name>someProgram</name></assembly>
  <members>
    <member name="P:SomeConnector.callSomeOtherProgram()">
      <summary>a method to connect to some program</summary>
      <remarks></remarks>
    </member>
  </members>
</doc>

We're clueless on how to so this. Anyone got ideas?

No Idea For Name
  • 11,411
  • 10
  • 42
  • 70
  • do what? what is needed to do? run a command line in java? or just run the program? – No Idea For Name Dec 08 '14 at 08:03
  • i edited my post. the exe file contains functions and our java program is suppose to call it rather than manually start the exe file and use its wizard to do things – lecarpetron dookmarion Dec 08 '14 at 08:06
  • so now you got me REALLY confused. if you have an exe file, that's a run program, that means you can run it, with or without parameters, but not call a function on it like a class library. maybe the exe gets the xml as parameter? – No Idea For Name Dec 08 '14 at 08:09
  • running the exe manually (double click) shows up a wizard with an input text field and some buttons which does different tasks. the idea is for our java program to automatically run it and provide the fields and execute which buttons we would like to trigger to do the function we want. the java program just automates whatever is done manually – lecarpetron dookmarion Dec 08 '14 at 08:20
  • That xml file looks a little bit like an attempt at providing you with documentation about the program. You haven't provided any details about how the exe is supposed to be used.. (command line arguments? Standalone from within your program?) – Sayse Dec 08 '14 at 08:52

1 Answers1

1

for running comman line in java use:

Runtime rt = Runtime.getRuntime();
Process pr = rt.exec("MyOtherProg.exe progParameter1 progParameter2");

judging by your comment and question i think you have a class library, and the right way to approach this would be to just create your own C# program that calls the different method on that class library using the given xml as a program args or other way

Edit

your comment:

unning the exe manually (double click) shows up a wizard with an input text field and some buttons which does different tasks. the idea is for our java program to automatically run it and provide the fields and execute which buttons we would like to trigger to do the function we want. the java program just automates whatever is done manually

answer:

ok, now we're coking with fire :)

so, at this point i would go to the vendor and ask if i can get a class library instead of the current ui, as you want it running automatically, without Human intervention. while on it i would check if you got other .dll files with the program. if so investigate them using VS.

one last thing, if all is turn bad and you have to do clicks, it's not lost yet, but at this point you have a lot of work, and i can't help you from here, but i'll send you to a link to start what you need and you'll explore from there:

Community
  • 1
  • 1
No Idea For Name
  • 11,411
  • 10
  • 42
  • 70
  • thanks but what about how to call its different functions? lets say i want to call "dotask1" now and "dotask2" later – lecarpetron dookmarion Dec 08 '14 at 08:09
  • running the exe manually (double click) shows up a wizard with an input text field and some buttons which does different tasks. the idea is for our java program to automatically run it and provide the fields and execute which buttons we would like to trigger to do the function we want. the java program should automate whatever is done manually. can this be done? – lecarpetron dookmarion Dec 08 '14 at 08:21
  • @lecarpetrondookmarion i've edited the answer adding the links to the mouse robot. please accept the answer if it helped you – No Idea For Name Dec 08 '14 at 08:38
  • yeah thats what ive been thinking too. it would be easier if they just provided us with a .dll file instead. just wondering if calling functions in an exe file is just the same as how java calls functions in a .dll file – lecarpetron dookmarion Dec 08 '14 at 08:39
  • @lecarpetrondookmarion i do not know of a way to do it, but maybe there is. however, the best way is to talk to the vendor – No Idea For Name Dec 08 '14 at 08:47
  • and that's what I provide in the answer for you but I don't know why it has been downvoted! – Hamid Pourjam Dec 08 '14 at 08:47
  • @HamidP because you also put so much unnecessary information like the c++ code. also you did not addressed the question at all – No Idea For Name Dec 08 '14 at 08:49