Results 1 to 13 of 13
Like Tree1Likes
  • 1 Post By Tolls

Thread: java.io.IOException: Cannot run program cmd.exe: CreateProcess error=5, Access denied

  1. #1
    geeky2012 is offline Member
    Join Date
    Oct 2012
    Posts
    7
    Rep Power
    0

    Unhappy java.io.IOException: Cannot run program cmd.exe: CreateProcess error=5, Access denied

    As a part of diagnostic effort we copied cmd.exe from system32 folder of windows to C:\\ drive and tried to run from an applet and get following exception :

    java.io.IOException: Cannot run program "cmd.exe": CreateProcess error=5, Access is denied

    The problem is with JRE 1.7 whereas on JRE 1.6 it runs fine.

    Renamed it to cmdx , runs fine.

    So any program named as cmd does not run at all.

    The applet jar is signed.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: java.io.IOException: Cannot run program cmd.exe: CreateProcess error=5, Access de

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,830
    Rep Power
    19

    Default Re: java.io.IOException: Cannot run program cmd.exe: CreateProcess error=5, Access de

    How are you running it?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  4. #4
    geeky2012 is offline Member
    Join Date
    Oct 2012
    Posts
    7
    Rep Power
    0

    Default Re: java.io.IOException: Cannot run program cmd.exe: CreateProcess error=5, Access de

    @DarrylBurke
    Runtime.getRuntime().exec(new String[] { "C:\\cmd.exe"});

    as well as

    Process p = new ProcessBuilder("C:\\cmd").start();

    None of them work, It used to work before with jre 1.6 and now we started certifying 1.7 for our software we this issue.

  5. #5
    geeky2012 is offline Member
    Join Date
    Oct 2012
    Posts
    7
    Rep Power
    0

    Default Re: java.io.IOException: Cannot run program cmd.exe: CreateProcess error=5, Access de

    The code is compiled in jdk 1.5 and running on jre 1.7.

    Runtime.getRuntime().exec(new String[] { "C:\\cmd.exe"});

    as well as

    Process p = new ProcessBuilder("C:\\cmd").start();

    None of them work, It used to work before with jre 1.6 and now we started certifying 1.7 for our software we this issue.

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,830
    Rep Power
    19

    Default Re: java.io.IOException: Cannot run program cmd.exe: CreateProcess error=5, Access de

    I would look into changes in the security side of the JVM between 6 and 7.
    They did tighten a lot of things up, and this looks like it could be one of them (assuming no other changes in environment).

    I would question why you are copying cmd.exe...
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  7. #7
    geeky2012 is offline Member
    Join Date
    Oct 2012
    Posts
    7
    Rep Power
    0

    Default Re: java.io.IOException: Cannot run program cmd.exe: CreateProcess error=5, Access de

    @ Tolls

    I tried running from System32 , full pathname as well it didnt work.

    Runtime.getRuntime().exec(new String[] { "C:\\Windows\\System32\\cmd.exe"});

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,830
    Rep Power
    19

    Default Re: java.io.IOException: Cannot run program cmd.exe: CreateProcess error=5, Access de

    So it will be permissions.
    I'm pretty sure they changed.
    I'd go through the change logs.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  9. #9
    geeky2012 is offline Member
    Join Date
    Oct 2012
    Posts
    7
    Rep Power
    0

    Default Re: java.io.IOException: Cannot run program cmd.exe: CreateProcess error=5, Access de

    I checked the permissions ,administrator privileges.
    So I tried copying into C:// drive when it dint run but no avail.

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,830
    Rep Power
    19

    Default Re: java.io.IOException: Cannot run program cmd.exe: CreateProcess error=5, Access de

    No, I mean what the JVM security will allow.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  11. #11
    geeky2012 is offline Member
    Join Date
    Oct 2012
    Posts
    7
    Rep Power
    0

    Default Re: java.io.IOException: Cannot run program cmd.exe: CreateProcess error=5, Access de

    FYi, it works on one machine while not on other. We saw this happening on 20% of machines we tested.
    I dont think so JVM will not allow run cmd.exe from a java program.

    Actual code was
    Runtime.getRuntime().exec(new String[] { "cmd.exe", "/c", myDoc.getFilename() });

    I broke it down to see it failed on cmd.exe

  12. #12
    geeky2012 is offline Member
    Join Date
    Oct 2012
    Posts
    7
    Rep Power
    0

    Default Re: java.io.IOException: Cannot run program cmd.exe: CreateProcess error=5, Access de

    The security has been tightened but how can it be fixed? I tried windows user account settings in control panel

    Control Panel > All Control Panel Items > User Accounts > Change UAC settings and move the slider down

    it works but it cant be recommended to clients, since if any malicious software opens we wont even prompt the user.

    So windows security and java 1.7 together are not working for this piece of code. Please help I have already spent a month trying to fix it.

  13. #13
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,830
    Rep Power
    19

    Default Re: java.io.IOException: Cannot run program cmd.exe: CreateProcess error=5, Access de

    There are pretty good reasons for tightening it up, as allowing applets free reign to parts of the system the user cannot access is simply dangerous, so the JVM prevents that.

    1.6 was clearly in the wrong here.
    DarrylBurke likes this.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Applet access denied error
    By JimBobJr in forum Java Applets
    Replies: 1
    Last Post: 04-10-2012, 10:18 AM
  2. Jni registry 'access denied' error.
    By durino13 in forum Advanced Java
    Replies: 4
    Last Post: 09-17-2011, 07:06 AM
  3. Access Denied Error using applets
    By vin_eets in forum Java Applets
    Replies: 0
    Last Post: 04-01-2011, 02:19 PM
  4. newbie here, access denied error?!?
    By kingpabs in forum JCreator
    Replies: 3
    Last Post: 04-01-2011, 02:16 AM
  5. Replies: 3
    Last Post: 04-10-2008, 09:01 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •