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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:42:09+00:00 2026-06-11T04:42:09+00:00

I have this String which I used with Runtime.exec() in JVM in Windows XP.

  • 0

I have this String which I used with Runtime.exec() in JVM in Windows XP.

String cmd = encoderFull + " " + "-i " + originalFull + " "+ "-bitrate" + " " + bitrateVBR[i] + " " + "-bvhq"+ " " + "-avi " + outputFull + " " + "2>&1" + " " + "1>"+ outputFile + ".txt";

Unoftunately ‘2>&1 1>output.txt’ doesn’t work. The rest is ok. Is there a way to use the commands so this file gets created?

Bye,
David

  • 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-11T04:42:11+00:00Added an answer on June 11, 2026 at 4:42 am

    Basically, no – what you are trying to do is not supported by Runtime.exec().

    Note that Runtime.exec is not a shell – in the case of exec(String), which you are apparently using, it tokenizes the string (with whitespace as the separator), and attempts to execute the first token as a program, with the rest of the tokens as arguments to that program.

    So, in your case, the redirection operators will be sent as parameters to the application named by the ‘encoderFull’ variable – they will not be interpreted by the shell as you expect, since there is no shell.

    As far as I know, you have two choices here:

    1. Write a batch file (for Windows) or a shell script (for *nix), that executes your application and does the redirection. Then invoke the shell (cmd or sh, or what-have-you), with the batch file / shell script as an argument, using Runtime.exec()

    2. Read the output stream from the process created by Runtime.exec and write the content to the appropriate file using java io

    I highly recommend #1 in favor of #2

    You should probably also read this article on “When Runtime.exec() won’t – Navigate yourself around pitfalls related to the Runtime.exec() method” before going any farther.

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

Sidebar

Related Questions

I have this 4 Dimensional array to store String values which are used to
Hi have this URL string which I need to extract possibly using regex but
I have this string of numbers var array = 1,6,2,9,5 which is retrieved from
I have a string which looks like this a 3e,6s,1d,3g,22r,7c 3g,5r,9c 19.3 , how
I have this function which returns a datatype InetAddress[] public InetAddress [] lookupAllHostAddr(String host)
I have some code which is doing this: String transactionId = incoming.getJMSCorrelationID(); when I
I have a string which has an xml inside. I want to write this
Is this Regex correct if I have to match a string which is atleast
I have some Java code which looks roughly like this: String urlString = ftp://polar.ncep.noaa.gov/pub/history/waves/multi_1.glo_30m.dp.200601.grb2;
I can't get this to work.. I have an String which I want to

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.