0

I am trying to open an exe file, specificly the IndriRunQuery.exe which is one of the tools that offers the Lemur Indri package. When i use the command prompt i write the following command:

IndriRunQuery Queries.txt

With this, the editting of the queries that are included in Queries.txt (which is passed as a parameter in the above command) is starting.

Then after a descent amount of time has passed ,i write the following in order to save the results that are produced in a file named Results.txt:

 IndriRunQuery Queries.txt >Results.txt

My problem is that every time that i want to edit a file which contains queries i need to do the same steps. i have 20 different query files to edit. I am trying to find a way to do it by using a java program but i can not figure it out.

I have used these lines of code but it doesnot work at all. Can anyone help me out with this?

ProcessBuilder builder = new ProcessBuilder("C:\\Program Files\\Indri\\Indri 5.8\\bin\\IndriRunQuery.exe", 
            "C:\\Users\\Πετρής\\Desktop\\TitlesRel.txt");
    builder.start();
    ProcessBuilder builder2 = new ProcessBuilder("C:\\Program Files\\Indri\\Indri 5.8\\bin\\IndriRunQuery.exe", 
            "C:\\Users\\Πετρής\\Desktop\\TitlesRel.txt",">C:\\Users\\Πετρής\\Desktop\\resultsexample3.txt");

    builder2.start();

1 Answer 1

1

The correct syntax is as below:

// Create ProcessBuilder.
ProcessBuilder p = new ProcessBuilder();
// Use command "notepad.exe" and open the file.
p.command("notepad.exe", "C:\\file.txt");
p.start();

Or

Process p = Runtime.getRuntime().exec("cmd /c start " + file.getAbsolutePath());
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.