Main.java 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import java.io.BufferedReader;
  2. import java.io.IOException;
  3. import java.io.InputStreamReader;
  4. import parser.OddsPortal;
  5. public class Main {
  6. public static void main(String[] args) {
  7. final OddsPortal op = new OddsPortal();
  8. System.out.println("Getting Yesterdays matches");
  9. op.getYesterdaysMatches();
  10. System.out.println("Getting Todays Matches");
  11. op.getTodaysMatches();
  12. System.out.println("Getting tomorrows matches");
  13. op.getTomorrowsMatches();
  14. op.getNextDaysMatches();
  15. // op.getHistoricMatches("soccer", "japan", "j2-league", "2020");
  16. // callingRScript();
  17. }
  18. private static void callingRScript() throws IOException {
  19. System.out.println(System.getProperty("user.dir"));
  20. final String rPath = System.getProperty("user.dir") + "\\src\\RScript\\scorePrediction.R";
  21. final Process exec = Runtime.getRuntime().exec("C:\\Program Files\\R\\R-3.6.3\\bin\\Rscript.exe " + rPath);
  22. final BufferedReader stdInput = new BufferedReader(new InputStreamReader(exec.getInputStream()));
  23. final BufferedReader stdError = new BufferedReader(new InputStreamReader(exec.getErrorStream()));
  24. // Read the output from the command
  25. System.out.println("Here is the standard output of the command:\n");
  26. String s = null;
  27. while ((s = stdInput.readLine()) != null) {
  28. System.out.println(s);
  29. }
  30. // Read any errors from the attempted command
  31. System.out.println("Here is the standard error of the command (if any):\n");
  32. while ((s = stdError.readLine()) != null) {
  33. System.out.println(s);
  34. }
  35. }
  36. }