I was hoping someone will be able to give me some advice. I am running a program in java and need to include a function that has already been written in bash. I honestly am not sure where to begin.
I have file that I process to some extent with my java program (I take out duplicates, sort names, etc). I end up with several paths to other files.
for(String go:parsun){
pathed="/home/S/Data/"+go+"/Ana/lysis/"+go+"/file.vcf";
System.out.println("Pathed: " + pathed);
}
I need to take these paths and put them through a bash program which takes the contents of the files and does some math-ish things to their innards. I have seen around the internet that you could do something like this to run a bash script in java:
Process pro=Runtime.getRuntime().exec("shellfilepath");
BufferedReader read=new BufferedReader(new InputStreamReader(pro.getInputStream());
But I am not sure I understand how that works, or how I would go about passing my file paths to it. Also, another consideration is that I will have to slightly modify the bash script to allow it to take in these paths. Previously the paths were hardcoded before hand. I will also need some suggestions on that front.
Is this the best way to have bash and Java work together? Is there another technique? If not, could someone help me with understanding how to use Runtime?
Thanks