Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9134593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:41:24+00:00 2026-06-17T08:41:24+00:00

I have an executable jar which prints some information to the screen. I want

  • 0

I have an executable jar which prints some information to the screen. I want to capture a specific number from the output which is the cost. There is a line “Cost = 10” for example and I want to have a list of costs when I run the jar file N times. I wanted to automate this process with a python script but since I am new to Python I do not know the best way to extract some data from stdout in a Python script. What would be the best way to do such task?

def wrapper(*args):
    process = Popen(list(args), stdout=subprocess.PIPE)
    process.communicate()
    return process

linkFileList = [ join(linkDir,f) for f in listdir(linkDir) if isfile(join(linkDir,f)) ]
nodeFileList = [ join(nodeDir,f) for f in listdir(nodeDir) if isfile(join(nodeDir,f)) ]
pairFileList = [ join(pairDir,f) for f in listdir(pairDir) if isfile(join(pairDir,f)) ]
size = len(linkFileList)
for count in range(0, size):
    x = wrapper('java', '-jar', 'C:\\Users\\fatma\\Documents\\workspace\\HeuristicRunnable.jar', nodeFileList[count], linkFileList[count], pairFileList[count])
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:41:25+00:00Added an answer on June 17, 2026 at 8:41 am

    You’re close. You want to do this instead:

    def wrapper(*args):
        process = Popen(list(args), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        stdout, stderr = process.communicate()
        return stdout, stderr
    

    The variables stdout and stderr will be simple strings corresponding to the output from stdout and stderr from the jar. I don’t really think you can do anything with the process variable once you’ve used it, so there really isn’t much point in returning it.

    (I also included the code you need to get the stderr in case that also proves to be useful)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the problem running executable .jar file. I've created a project which contains
I have a executable jar file and i want to see code behind it.
We have an executable jar file that can be run from the command line
So I have an executable jar file which when run in windows or in
I have a desktop application , which is packaged as a self-executable jar file,
I have an executable JAR which runs in the command line. I would like
I have problem with building the single executable jar from multiple maven modules. So
I have a java application which is packed into an executable jar file and
I have an executable jar Client.jar that requires jndi.properties file. Since the jndi properties
I have made a java application and have packed it into an executable jar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.