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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:41:46+00:00 2026-05-19T15:41:46+00:00

I currently convert an application to use CreateProcessW() instead of Runtime.exec() as I need

  • 0

I currently convert an application to use CreateProcessW() instead of Runtime.exec() as I need the information it provides. However any call to CreateProcessW() fails with the error code 5 (ACCESS DENIED). I have been unable to find out why this happens as Runtime.exec() runs fine in the same case.

My error could be in one of the following code snippets, the method call and the jna interface.

public ProcessInfo createProcess(String dir, String name){
            ProcessInfo pi = new ProcessInfo();
            StartupInfo start = new StartupInfo();
            mem.CreateProcessW(new WString(name),
                    null,
                    null,
                    null,
                    false,
                    0,
                    null,
                    new WString(dir),
                    start.getPointer(),
                    pi.getPointer());
            return pi;
        }

My definition of CreateProcessW

boolean CreateProcessW(WString apname,
                    char[] comline,
                    Pointer p,
                    Pointer p2,
                    boolean inheritHandles,
                    int createFlags,
                    String environment,
                    WString directory,
                    Pointer startinf,
                    Pointer processInfo);

Additional Info:

  • Runtime.exec() succeeds with the given Strings
  • The size of StartupInfo is set
  • Testenvironment used: WinXP SP3 and Netbeans 6.9.1

Example parameters used:

  • Name: moviemk.exe
  • Dir: C:\Programme\Movie Maker\

Also tested with different paths, so not a whitespace problem

Thanks

Update:

As it turns out the error was caused by my calling code switching around working dir and exe path after I checked them. Because of the resulting access denied I actually thought that it at least found the exe. I will add an IllegalArgumentException to take care of that problem.

Since I had the additional error with the exe being relative to the working dir I will accept that answer. Thanks to all for helping.

  • 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-19T15:41:47+00:00Added an answer on May 19, 2026 at 3:41 pm

    CreateProcessW’s first parameter has to be either a full path or a path relative to the current directory. It can’t be a path relative to the working directory parameter, which seems like what you’re expecting it to do.

    Try passing C:\Programme\Movie Maker\moviemk.exe as the name parameter

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

Sidebar

Related Questions

I'm currently working on a Silverlight app and need to convert XML data into
I have crystal report and I need to convert it to text file. Currently
I'm currently building an application using entity framework. Normally I would use a stored
i am currently trying to convert an integer into a list. E.g. 1234 =>
I am currently working on a project to convert a number of Excel VBA
I'm currently refactoring code to replace Convert.To's to TryParse. I've come across the following
I'm currently using abcPDF 7 to convert HTML to PDF. This is done via
The situation: I need to convert our current development environment from Windows XP 32-bit to
I have an existing application that displays Google Analytics data. Currently, it stores the
I am currently developing a new WPF application and have the majority of my

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.