class AlertSender {

    public static void send(String alertScript, String message) {
        try {
            Process alert = Runtime.getRuntime().exec(alertScript + " \"" + message + "\"");
            alert.waitFor();

            try (BufferedReader reader = new BufferedReader(new InputStreamReader(alert.getInputStream()))) {
                StringBuilder sb = new StringBuilder();
                String line;
                while ((line = reader.readLine()) != null) {
                    sb.append(line).append("\n");
                }

                int exitValue = alert.exitValue();
                if (exitValue != 0) {
                    System.out.println("Exit Code:" + exitValue);
                    System.out.println("Message: " + sb.toString());
                }
            }
        } catch (IOException | InterruptedException e) {
            e.printStackTrace();
        }

        sendCounter.incrementAndGet();
    }

    private  AlertSender();

}