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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:41:11+00:00 2026-06-06T20:41:11+00:00

I have an Stand alone Application which runs Shell Script(with parameters)in Ubuntu. ProcessBuilder pb1

  • 0

I have an Stand alone Application which runs Shell Script(with parameters)in Ubuntu.

ProcessBuilder pb1 = new ProcessBuilder("sh","deltapackage_app.sh","part_value","pathtofile"); 
Process process1 = pb1.start();

I am taking parameter through GUI.
Now same thing i want to implement in web application where i can take inputs form web page and send it to server and then server will execute the shell script with parameters.

Can any one suggest me the best way of doing this. What things should i use to do this.

I Know i have to learn many things about server. Or can i use same code with Browser based Application.

  • 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-06T20:41:13+00:00Added an answer on June 6, 2026 at 8:41 pm

    Consider the following line of code:

    Process p = Runtime.getRuntime().exec("/bin/sh -c /bin/ls > ls.out");
    

    This is intended to execute a Bourne shell and have the shell execute
    the ls command, redirecting the output of ls to the file ls.out. The
    reason for using /bin/sh is to get around the problem of having stdout
    redirected by the Java internals. Unfortunately, if you try this
    nothing will happen. When this command string is passed to the exec()
    method it will be broken into an array of Strings with the elements
    being “/bin/sh”, “-c”, “/bin/ls”, “>”, and “ls.out”. This will fail,
    as sh expects only a single argument to the “-c” switch. To make this
    work try:

        String[] cmd = {"/bin/sh", "-c", "/bin/ls > out.dat"};
        Process p = Runtime.getRuntime().exec(cmd);
    

    Since the command line is already a series of Strings, the strings
    will simply be loaded into the command array by the exec() method and
    passed to the new process as is. Thus the shell will see a “-c” and
    the command “/bin/ls > ls.out” and execute correctly.

    http://www.ensta-paristech.fr/~diam/java/online/io/javazine.html

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

Sidebar

Related Questions

I have Developed an Stand alone application (.jar) which is working on Linux environment,
I have stand alone Java Application with Spring 3.0. I am calling REST service
Question fellow programmers. Let's say I have a stand alone application in it's own
I want to create an application that runs on the users computer, a stand-alone
I have a stand alone java application that receives SNMP messages via an SNMP
I have a stand-alone java application that makes some database read/write business on a
I am developing a stand-alone java application which uses eclipselink. It is all fine
I have a requirement to create a component which can be used stand-alone or
I am developing a stand-alone java application which gathers data from around 1000 measuring
I have a standalone application in which I have to prompt the user with

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.