How do you run terminal commands with a file?


#1

I am working on some Java code, and to compile and run it, i have to separately run five terminal commands. Is there a way to put those commands in a file, and run the file (instead of running the separate commands)?

Such commands are:
14


#2

You should be able to create a runner for this to execute the commands. You can find instructions on how to do this here: https://docs.c9.io/docs/custom-runners


#3

Thanks, it was useful. Where would I put the file? Under .c9 folder?


#4

The default location is .c9/runners. Runners in this folder should be picked up by the IDE.


#5

Okay, thanks. Also, can I just create a runners folder, if my workspace does not have one?
Secondly, how would i structure having it rum multiple commands?

My theory:
{
“cmd” : [""] // command 1
“cmd” : [""] // command 2
// and so on…
}


#6

use script like this


#7

Okay, but, can I still use my theoretical situation? Or, will that not work at all?

My theory:
{
“cmd” : [""], // command 1
“cmd” : [""] // command 2
// and so on…
}


#8

no, you need to use script: ["", ""] same as in other runners


#9

Now, since I do not have a .c9/runners folder, can I just create one?
And if I am understand you, can I do this?

{
script : [
“”, // first command
“” // second command
// and so on…
]
}


#10

Okay, next problem. I used code similar to what harutyun had, but i get a error when I try to run it.

It said:
bash: line 1: .c9/runners/compile_java_sources.run: No such file or directory

Here is my .c9 folder directory
:stuff

I did have to make my runners folder, the project did not have one by default (for some reason).