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

The Archive Base Latest Questions

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

I have a simple shell script which looks like this: R –vanilla<myMRjob.R hadoop fs

  • 0

I have a simple shell script which looks like this:

R --vanilla<myMRjob.R
hadoop fs -get /output_03/ /home/user/Desktop/hdfs_output/

This shell script runs myMRjob.R, and gets the output from hdfs to local file system. It executes fine from terminal.

When i am trying to run shell script from java code, i am unable to launch the MapReduce job i.e. the first line isn’t getting executed. While “hadoop fs -get ..” line is running fine through Java code.

Java code which i used is:

import java.io.*;

public class Dtry {

   public static void main(String[] args) {

       File wd = new File("/home/dipesh/");
       System.out.println("Working Directory: " +wd);
       Process proc = null;

       try {
           proc = Runtime.getRuntime().exec("./Recomm.sh", null, wd);
       } catch (Exception e) {
         e.printStackTrace();
         }
   }
}

The reason behind this whole exercise is that i want to trigger and display the result of the myMRjob.R in JSP.

Please help!

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

    The reason your shell script isn’t running from the exec call is because shell scripts are really just text files and they aren’t native executables. It is the shell (Bash) that knows how to interpret them. The exec call is expecting to find a native executable binary.

    Adjust your Java like this in order to call the shell and have it run your script:

    proc = Runtime.getRuntime().exec("/bin/bash Recomm.sh", null, wd);
    

    When you called hadoop directly from Java, it is a native executable and that’s why it worked.

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

Sidebar

Related Questions

A really simple shell script question. I have a file with something like this:
I have a crontab that looks like: SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ 0-59 * *
I have this simple script: param([string[]]$to=markk, $subject=$null, $body=$null, $from=name, $suffix=@example.com, $server=dev-builder) function NormalizeAddress([string]$address) {
I have a simple shell script that builds my Roxygen documents, builds the package,
I am making a simple shell script which will minimize the time I spend
I have a simple shell script whose also is below: #!/usr/bin/sh echo starting the
I have wrote a simple shell script where I have only mentioned the following
I am really stumped on this one. I have a simple python wrapper which
I have this simple php script <?php echo '<pre>'; // Outputs all the result
I have a simple shell script that starts chromium in kiosk mode on a

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.