I have a php file which stores a Json string in a $result. I now have a java program which processes it and the main func returns a string array. Being new to java,Im not sure what argument to pass while creating a run configuration. And when i try to export the runnable jar(leaving the run config arguments empty), it says main method not found in the class. I feel its something to do with the argument passing, but im not sure how to do it. Sorry for this noob question. Here are my codes:
package jiraBurnDown;
public class JiraCurrentSprintBurnDownDataAttributes {
public long _startTime = 0;
public long _endTime = 0;
public String sprintResponse;
public String _statisticsField = "";
public Map<String, JSONArray> _changes = new HashMap<String, JSONArray>();
public Map<String, IssueState> _changesByIssue = new HashMap<String, IssueState>();
public class IssueState {
public boolean isInSprint = false;
public Double estimatedWork = 0.0;
public IssueState(boolean isInSprint, Double estimatedTime) {
this.isInSprint = isInSprint;
this.estimatedWork = estimatedTime;
}
public String[] main(String sprintResponse) {
String res[]=null;
JSONObject obj = (JSONObject) JSONValue.parse(sprintResponse);
if (obj != null) {
//createEmptySeries();
res=extractAllInfo(obj);
}
else
System.out.println("Not Working ");
return res;
}
}
private String[] extractAllInfo(JSONObject obj) {
String statisticField =extractStatisticsFieldName(obj);
String time=extractStartAndEndTime(obj);
String changes=extractChangesInfo(obj.get("changes"));
String workData=extractAndSaveBaseLine(obj.get("workRateData"));
String scopeChanges=extractAndSaveScopeChange();
String[] info=new String[5];
info[0]=statisticField;
info[1]=time;
info[2]=changes;
info[3]=workData;
info[4]=scopeChanges;
return info;
}
private String extractStatisticsFieldName(JSONObject obj) {
Object rawObj = obj.get("statisticField");
if (rawObj != null && rawObj instanceof JSONObject) {
_statisticsField = ((JSONObject) rawObj).get("name").toString();
//addPoint(DataAttributes.DEFAULT_SERIES_NAME, _statisticsField);
}
return _statisticsField;
}
//and other functions to process the JSON obj
and my php file is
$result=curl_exec($ch);
curl_close($ch);
$result=json_decode($result, true);
$result=json_encode($result);
$out=shell_exec("java -jar /JiraInfo.jar $result");
var_dump($out);