1 year ago

#347546

test-img

Hoàng Nguyễn

Execute jar file on multiple clients

i have a telegram bot application that execute jar file in the server by message with path to jar file.

public SendMessage startApp(String path, long chatId, int messageId) {
    Runtime run = Runtime.getRuntime();
    SendMessage sendMessage = new SendMessage();
    Process p = null;
    try {
        p = run.exec(path);
        check = true;
    } catch (IOException e) {
        check = false;
        e.printStackTrace();
        p.destroy();
    } finally {
        if (check) {
            sendMessage.setChatId(String.valueOf(chatId));
            sendMessage.setText("Đã bật app với đường dẫn " + path);
            sendMessage.setReplyToMessageId(messageId);
            return sendMessage;
        } else {
            sendMessage.setChatId(String.valueOf(chatId));
            sendMessage.setText("Sai đường dẫn " + path);
            sendMessage.setReplyToMessageId(messageId);
            return sendMessage;
        }
    }
}

As i know, it only solves problem with client that running app, i want to execute jar file in another clients. Is it possible if i provide ip address of client? If possible, what i can do? Thanks!

java

sockets

server

client-server

telegram-bot

0 Answers

Your Answer

Accepted video resources