I am trying to run a Linux command from Java. The command runs perfect from command line itself but from Java it does not. The command from command line is
curl -H "Content-Type: text/plain" -d "$(printf '#Genes\nPIK3C2A\nPTEN\nUNC5B')" -X POST --url https://reactome.org/AnalysisService/identifiers/projection/
The command from Java is
String $notifyMsg="\"$(printf '#Genes\nPIK3C2A\nPTEN\nUNC5B')\"";
String $reactome = "https://reactome.org/AnalysisService/identifiers/projection/";
String $notifyTitle= "\"Content-Type: text/plain\"";
String $command = "curl" + " " + "-H"+ " " + $notifyTitle + " "+ "-d " + $notifyMsg +" "+ "-X" + " " + "POST" + " " + " " + "--url" +" " + $reactome;
System.out.println("Command is: " + $command);
Process p=Runtime.getRuntime().exec($command);
p.waitFor();
System.out.println("Run Result " + p.exitValue() )
I am supprosed to get an output like this
{"summary":{"token":"MjAxODAxMjMxNjQyMDZfNjcy","projection":true,"interactors":false,"type":"OVERREPRESENTATION","sampleName":"Genes","text":true},"expression":{"columnNames":[]},"identifiersNotFound":0,"pathwaysFound":51,"pathways":
But instead i get 0 . Can anyone tell me what could be wrong?