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

  • Home
  • SEARCH
  • 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 8698001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:38:52+00:00 2026-06-13T01:38:52+00:00

Running this command in the terminal works fine: java -jar file.jar –arg1 –arg2 pathTofile

  • 0

Running this command in the terminal works fine:

java -jar file.jar --arg1 --arg2 pathTofile

When I then try to do this from the python code using following code:

subprocess.call(['java', '-jar', 'file.jar', '--arg1' , '--arg2' , 'pathTofile'])

I get an IllegalArugmentException for –arg1.

Any ideas on why this could generate a problem?

  • 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-13T01:38:53+00:00Added an answer on June 13, 2026 at 1:38 am

    Ok I figuered it out.
    When using the subprocess routine in python you need to quote the option and concurrent value seperatly

    eg:

    subprocess.call(['java', '-jar', 'file.jar', '-option', 'valueForThisOption', '-option', 'valueForThisOption', 'pathToFile'])
    

    putting the -option and value in one quote generates this error.
    I have read somewhere that you can only put the -option and value in one quote if you put shell=True at the end. (untested)

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

Sidebar

Related Questions

Say suppose I am running a java program through command line. And this program
In ZF you create a project by running this command: zf create project MyProjectName
When running this powershell command Get-ChildItem -Recurse -Include *.txt You get multiple tables in
The current error when running this from the command line is Call to a
Okay so I am running a simple command like this: find / -name ssh
I am running the following command from my home directory: python -m CGIHTTPServer This
I am getting this weird error while running cucumber test: ERROR Mongo::OperationFailure: Database command
I am using a interactive command line program in a Linux terminal running the
I have installed ffmpeg on my server and it works fine via my terminal.
I'm writing a terminal wrapper for a command-line program in Java, and I spawn

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.