Saturday, 15 January 2011

java - Running Jar files from Python -


I want to create a program that can execute jar files and whatever the pair file in my Python program is doing Can print but without using the Windows command line, I have searched the entire web, but nothing is going on with doing so.

My program is a Minecraft server cover and I want to run it on server.jar and instead of running it in Windows Command Prompt, I want to run it in Python Open I am

Any thoughts?

You must first execute the program. An easy task to do this:

  def run_command (command): p = subprocess.open (command, stdout = subprocess.PIPE, stderr = Subprocess .STDOUT) Returns (p.stdout.readline, b '')   

This will repeat with all the rows of the output.
and you can access the lines and print it in Run_command ('java -jar jarfile.jar') for output_line

  Use: Print (Output_line)   

Also add Import subprocess , as run_command uses.

No comments:

Post a Comment