0

I am using the following code to execute an SH file in Linux

Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", file.getPath() });

This code works however I can't use the screen command in the SH file when executing it from Java, I get this error

Must be connected to a terminal.

So is it possible to "connect" java to a terminal? I would like to be able to also view this screen when I connect via SSH so I think it has to be connected to the terminal that is shown when you SSH into the server.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Keir Nellyer
  • 913
  • 5
  • 12
  • 20

1 Answers1

0

I found that if I use screen -dm it will work. Thanks!

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Keir Nellyer
  • 913
  • 5
  • 12
  • 20