0

what i tried

try {
    File fileDir = new File("B:\\Palringo\\palringo.exe");
    BufferedReader in = new BufferedReader(
       new InputStreamReader(
              new FileInputStream("B:\\Palringo\\palringo.exe"), "UTF8"));

    String str;

    while ((str = in.readLine()) != null) {
        System.out.println(str);
    }

        in.close();
    }
    catch (UnsupportedEncodingException e)
    {
        System.out.println(e.getMessage());
    }

Output :

unreadable Strings

what i want

i want to control the (palringo.exe) so i can make Bot for it

What is palringo.exe ?:

its a chatting program you can download it or use web version (palringo.im).

am i doing wrong by opening a file that is exe ? should i connect to the website by Connection classes in java ? if so , how i can connect it ?

a.jo
  • 3
  • 1
  • http://stackoverflow.com/questions/4272956/run-a-sub-process-provide-input-and-output-to-it-correctly-in-java ? –  Apr 04 '17 at 18:05
  • Possible duplicate of [Run a sub process, provide input and output to it correctly in Java](http://stackoverflow.com/questions/4272956/run-a-sub-process-provide-input-and-output-to-it-correctly-in-java) – Mikhail Antonov Apr 04 '17 at 18:06
  • its not what i asked for guys , but thanks for trying to help <3 – a.jo Apr 04 '17 at 18:10

2 Answers2

0

This doesn't work. You cannot read an exe file.

You need to have the source code or library to add that software to you code. You simply cannot read a exe file and extract code, because exe file will be encrypted and it will be in lower level languages.

But you can use exec() to run that exe file.

Arvindsinc2
  • 716
  • 7
  • 18
  • so , can i extract the output by using Connection classes in java ? – a.jo Apr 04 '17 at 18:09
  • rly thanks for trying to help , but i tried to do as he did but still no output – a.jo Apr 04 '17 at 18:20
  • Welcome sir...what output are you expecting? – Arvindsinc2 Apr 04 '17 at 18:21
  • it should be whatever people writing in that (palringo.exe) program – a.jo Apr 04 '17 at 18:26
  • You cannot do that... you can just run that program but cannot access its resources...by the way why do you want to use that?.. are you trying to build a chat application? – Arvindsinc2 Apr 04 '17 at 18:29
  • no sir , i want to do that so i can make a bot to solve mathematics problem if any user enter for example 1*2 , so my program should enter 2 in the same (palringo.exe) program – a.jo Apr 04 '17 at 18:34
  • I am sorry... but I don't think you can do that... the problem is palringo is a third party apparently and you can't access it, unless palringo gives a SDK or some API – Arvindsinc2 Apr 04 '17 at 18:37
  • there is API https://www.nuget.org/packages/PalringoApi but it seems im noob enough that i dont know the commands ,and how i can import it to java – a.jo Apr 04 '17 at 18:40
  • im rly sorry to bother you sir , thank you anyway <3 – a.jo Apr 04 '17 at 18:42
0

I know this is a very late answer, if you are looking to connect and manipulate palringo, there are a couple of APIs available.

https://github.com/calico-crusade/PalringoApi

This specific one can also be found on Nuget, though it is for C#. You could copy over the majority of the connection code to Java if you wish.

Cardboard
  • 25
  • 4