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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:28:40+00:00 2026-05-18T12:28:40+00:00

Initially I ran this code without the leading cmd and I received an access

  • 0

Initially I ran this code without the leading "cmd" and I received an access denied message. Postgres is being run as a service by an account that cannot be logged into and I am an administrator running this application. The attempt with "cmd" included returns me no input. My question is how do I go about executing these statements to achieve the resulting files and data changes?

 String[] psqlCommands = {"cmd ",postgresLocation, " -dDatabase ", " -UUser ",
                "-c ",  "UPDATE host.user SET service = 1 WHERE service = 1;" +
                        "UPDATE host.permission SET service = 1 WHERE service = 2"};
       Runtime.getRuntime().exec(psqlCommands);

        String[] pgDumpCommands = {"cmd ", postgresLocation, " --data-only ",
                "-t host.user_info -t host.permission -t host.group -t host.account -t host.password " +
                        "-UUser Database> "
                        + DATA + "\\dataExport.sql"};

        Runtime.getRuntime().exec(pgDumpCommands);

The exception that is generated is an Access Denied exception that is on the Postgres_Bin directory. I will post a trace once I get the necessary materials.

Exception in thread "main" java.io.IOException: Cannot run program "d:\program f
iles\postgres\bin": CreateProcess error=5, Access is denied
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at Thing.main(Thing.java:85)
Caused by: java.io.IOException: CreateProcess error=5, Access is denied
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 4 more

  • 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-05-18T12:28:40+00:00Added an answer on May 18, 2026 at 12:28 pm

    java.io.IOException: Cannot run program “d:\program files\postgres\bin”

    This error indicates that the spaces in the path confuse the exec() call (and the directory bin is indeed nothing that Windows can run)

    Make sure you enclose the full path to the .exe with double quotes because of the spaces.

    I think using ProcessBuilder is recommended over using exec() as you can specify the arguments and the program to run with different parameters avoiding the escaping of path names with spaces.

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

Sidebar

Related Questions

Ok this must be something dumb. I ran into this when moving some code
I got the code from this question, I ran it in Eclipse and the
In trying to restore the original payload in a message, I ran into this
We have few components like libraries dlls When initially created I ran the following
Initially I had designed this flash based navigation menu for my website, after going
Initially I had the habbit of directly writing the php code in the <?php
Initially I thought this was going to work, but now I understand it won't
As an experiment I ran the following code snippet (simplified): public class SGamePlay extends
I found the following code in SO. Does this really work? String xml =
I have the following code, this code runs when a person clicks a link.

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.