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 6183385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:21:21+00:00 2026-05-24T01:21:21+00:00

I have a java program which does individual jobs e.g. takes in a file,

  • 0

I have a java program which does individual jobs e.g. takes in a file, does some processing on it and creates a new file. To run it I have to type the following in the command line.

java myprogram.jar -input myfile1.txt -output output/myfile1.txt

However i wish to batch process a few thousand files, so i would like to increment the number at the end of the myfile part of the string. So once the first job is finished, the second job will then start, and so on so forth. Rather than have thousands of instances of the java program running at the same time.

Any help would be appreciated.

Jon

  • 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-05-24T01:21:22+00:00Added an answer on May 24, 2026 at 1:21 am

    I would use bash or something, but if you need to use python, you can use subprocess.call to do this:

    from subprocess import call
    for i in range(1,1000):
        call(["java myprogram -input myfile%d.txt -output" % (i)])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a small Java program which I would like to run both
I have a simple Java program which reads a file directory and outputs a
I have a Java program using AWT which I would like to run on
I have written a program in Java which creates a socket connection for a
Unix gurus! I have a Java program which passes some parameters to a Servlet
I have java API which return this type: ArrayList[ArrayList[String]] = Foo.someJavaMethod() In scala program,
We have a Perl program to validate XML which is invoked from a Java
We have a Java program run as root on Unix, that therefore can read
I have a Java program in which an action is initiated which loops through
Hoping someone can shed some light on this. I have a PHP program which

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.