-1

I have a java application using switch-case in while loop to excute command. How can i pass params to a running background java process via bash script ?, I don't want to using socket or webUI to pass data. Here is my code:

    public static void main(String[] args) throws IOException {
    boolean eof = false;
    Scanner sc = new Scanner(System.in);
    while (!eof) {
        System.out.println("Enter your command!");
          String data = sc.useDelimiter("\\<end>").next();
        CommandField cmdF = gson.fromJson(data, CommandField.class);
        switch (Command.Parse(cmdF.getCommand())) {
            case LOGIN:
                result = client.isLogged();
                if (result) {
                    System.out.println("successful!");
                } else {
                    System.out.println("failed!");
                }
                break;
        }

}

Trung Nguyen
  • 69
  • 1
  • 9

1 Answers1

0

You can only pass variables to a running process by dedicated interfaces. To my mind come the following options:

But the program you want to pass the parameters to must provide an implementation of the interface. Otherwise there is no possibility to pass something if the process has no option to receive it.

markusw
  • 1,975
  • 16
  • 28