Runtime.getRuntime.exec JavaWeb Ubuntu executes high-occupancy python scripts

1. The script needs to be executed, the script is highly occupied and blocked in JavaWeb

python test.py

2. Call the system terminal

gnome-terminal

Note: Here gnome-terminal -x bash -c "python test.py" can be called directly in cmd.

But with Runtime.getRuntime().exec() method, the following parameters cannot be read (I can’t read it)

3. Solution:

Write gnome-terminal -x bash -c "python test.py" into the test.sh shell script.

Use Runtime.getRuntime().exec() to call test.sh.

PS: I have searched the Internet for a long time, and there is no similar situation... So I used this last resort... If you have a solution, chat with me privately

 

Guess you like

Origin blog.csdn.net/qq_41854291/article/details/105693079