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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:44:53+00:00 2026-06-06T08:44:53+00:00

I am writing an application that sends commands to a unix shell. I am

  • 0

I am writing an application that sends commands to a unix shell.

I am not ever having any troubles with issuing cp and chmod commands (that i know of) but for some reason mv commands will not actually move the files i spedify?

My code can be show cased as follows:

    import java.io.IOException;
    public class ExecuteCommand {   
        public static void main(String[] args){
            ExecuteCommand exec = new ExecuteCommand("cp /some/directory/file.txt /some/directory/of/mine/");
            ExecuteCommand exec2 = new ExecuteCommand("chmod 666 /some/directory/of/mine/file.txt");
            ExecuteCommand exec3 = new ExecuteCommand("mv /some/directory/of/mine/file.txt /some/directory/of/mine/subDirectory/");
        }
        public ExecuteCommand(String command) {
            try {
                    System.out.println("EXECUTING!::" + command);       
                    Process child = Runtime.getRuntime().exec(command);             
            } catch (IOException e) {
            }
        }

    }

I have tried putting timers in between the commands with no progress being made to ensure that %100 of my commands are processed.

Please note that my code includes sample info, if some of the unix file system syntax is incorrect, forgive me, and please do not blame the problem on that.

If you need any further info please ask and i will provide asap

Thanks Guys =)

  • 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-06T08:44:54+00:00Added an answer on June 6, 2026 at 8:44 am

    One problem with your sample code is that you are squashing the exceptions. If there is any problem you are throwing away the evidence.

    A second problem is that you are not waiting for one command to complete before launching the next one. If a later one depends on an earlier one finishing, it will fail.

    A third problem is that you are not checking command return / exit codes, or looking at any error messages that they might produce. The error messages might tell you why commands are not working … if you bothered to fetch and print them.

    The final (meta-)problem is that this is not your real code … so we don’t know if the problems we are seeing are just artefacts of your Question. Please provide REAL code, not some poorly bowdlerized version.

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

Sidebar

Related Questions

I am writing an application that sends command line commands to a 3rd party
Writing a client application that sends images to a server via a webservice. As
I'm writing a WinForms application that sends email messages (like a mail merge). I'd
I'm writing an application that sends files over network, I want to develop a
I am writing a Bash shell script for Mac that sends an email notification
I'm writing an application in classic ASP (yes, please forgive me) that sends e-mails
I am writing a little application that is supposed to listen for user commands
I'm writing an application that sends requests to the PHP CLI. However, as i
I'm writing a small (C#) client application that sends data using a TCP/IP connection
I am writing a C# .NET server application that sends and receives data over

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.