1

I'm testing tidesdk.

I have a java program that reads from standard input. I run the program through the console console

java -cp MyProgram.jar package.MyMainClass

And then execute commands and get results.

there any way to do with tidesdk?

Edit: The problem was that calls the java program with a list of one element (which contained the command separated by spaces) It solved with passing every word to a item of list (and removing the spaces). Right now I have porblemas to write standard input. This is what I'm trying.

 var input = Ti.Process.createPipe();

 var process = Ti.Process.createProcess({
                   args:['java', '-cp', 'C:/.../MyProgram.jar', 'package.MyMainClass'],
                   stdin: input
                });

    //process.setOnReadLine(function(line) { alert(line) });
    process.launch();

    input.write("comand parameter1 parameter2\n"); //This line does not work

The java program starts. But never gets a command.

user60108
  • 3,270
  • 2
  • 27
  • 43

1 Answers1

2

Checkout Documentation of Ti.Process.createProcess. That is exactly what you are looking for:

http://tidesdk.multipart.net/docs/user-dev/generated/#!/api/Ti.Process

Mital Vora
  • 2,199
  • 16
  • 19
  • thank you very much. I edited the question to explain the problem I'm having. Java program does not get any command from standard input. – user60108 May 11 '13 at 20:22
  • 1
    I would generally pass the required parameters at onset as commandline parameters to the process. This may be a not implemented feature or a bug in process class. We will have a look at it. Can you please file an issue https://github.com/TideSDK/TideSDK/issues – Mital Vora May 13 '13 at 05:31
  • I created the issue https://github.com/TideSDK/TideSDK/issues/190 I hope you understand. thanks – user60108 May 14 '13 at 00:59