I am executing a python script from Java using Process approach. I have this code part where I have a StringBuilder with following structure:(val1,val2,...).
Now I have this part of code which uses Process approach to execute the python scripts from within Java code:
ProcessBuilder pb = new ProcessBuilder("python","test1.py");
Process p = pb.start();
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
int ret = new Integer(in.readLine()).intValue();
Now what I want is to first check if my StringBuilder str is empty or not i.e. the string is just () and there is nothing inside () in str. If it is not empty (i.e. there are values inside ()) then I need to pass each value as a separate parameter with the Process call for my python script. For example if my str is (val1,val2) then I need to pass val1 and val2 as a separate parameters in the Process call for executing the python script from within Java code.
How can I modify my current code to include this?