This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 225563

Summary: Cannot debug file OR package: "elevation required"
Product: projects Reporter: zweibieren <zweibieren>
Component: AntAssignee: Milos Kleint <mkleint>
Status: RESOLVED WONTFIX    
Severity: normal CC: mmirilovic, zweibieren
Priority: P1    
Version: 7.2.1   
Hardware: PC   
OS: Windows 8 x64   
Issue Type: DEFECT Exception Reporter:
Attachments: stack trace

Description zweibieren 2013-01-30 21:27:50 UTC
Created attachment 130858 [details]
stack trace

My attempts to debug a file or a project fail with the infamous:

 java.io.IOException: Cannot run program "C:\Program Files\Java\jdk1.7.0_11\bin\java.exe" (in directory "U:\Fred\java\Indexer"): CreateProcess error=740, The requested operation requires elevation

This message indicates that some permission is not high enough. And yet, 
java.exe and the class files all have at least read and execute permissions. Indeed, NetBeans has no trouble writing into the various project directories.

All routes  to debugging (icon, menu, keyboard F5) fail in the same manner.
Giving ALL permissions to java.exe does not help.

There have been numerous bug reports of CreateProcess error=740, such as, 
    Bug 117803 - java.io.IOException: Cannot run program "C:\JARA-please": 
    Bug 131598 – java.io.IOException: Cannot run program "C:\Users ...
    Bug 156811 – Cannot run program ".netbeans\6.1\config ...
    Bug 157357 – java.io.IOException: Cannot run program "C:\Program ...
    Bug 164417 – java.io.IOException: Cannot run program "C:\Program ...
    Bug 205618 – java.io.IOException: CreateProcess error=740, The ...
    Bug 223863 – java.io.IOException: CreateProcess error=740, The ...
None of these seem to apply to simply trying to debug a program.  Most of them precede Windows 8.
Comment 1 zweibieren 2013-01-30 23:49:47 UTC
The same error occurs if I try to RUN a file or project.
Comment 2 Martin Entlicher 2013-01-31 07:54:49 UTC
This is to be handled in the ANT project IMHO (and the same problem can probably occur in Maven as well).
Comment 3 Milos Kleint 2013-01-31 08:15:28 UTC
please see 
http://mark.koli.ch/2009/12/uac-prompt-from-java-createprocess-error740-the-requested-operation-requires-elevation.html

and http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6410605

it's not about the permissions of the java executables but about the permissions of your user on the computer, please make sure you are running netbeans as administrator.

in both ant and maven we IMO don't have direct influence over how the debugged process gets spawned, it's handled by the maven-exec-plugin respectively the java ant task.
Comment 4 zweibieren 2013-01-31 18:34:30 UTC
It may be a bit hasty to mark this bug as "resolved."

a) The failure does NOT occur under x86.
   Even when running as not-an-administrator.
b) I WAS running as administrator on the X64 release. 
   And was not able to run or debug any program.
c) Requiring that NetBeans be run as an administrator
   is a poor policy. Running as administrator 
   is a main route of virus infestation. And it would
   be unpleasant to switch modes just to run NetBeans.
   I often need to browse the web while running NetBeans.

I see that the 704 issue has been unresolved for at least 
five years now. It is about time for a concerted drive to 
find a solution, at least for the NetBeans use-case of 
starting an executable. Oracle. Apache, and NetBeans 
ought to work with Microsoft to convene a meeting to 
find some solution. Perhaps Microsoft can create
special licensing so a few organizations can offer 
selected applications that always run as administrator.
Or perhaps the notion of sandboxes can be generalized.
Comment 5 Milos Kleint 2013-02-01 06:21:13 UTC
well, what is your expected behaviour in this case? The first/all Run/Debug would show the blackscreen asking for permissions?

running all external processes through cmd /c has it's own set of problems as far as I can remember (and afaik requires you to run the command line always as administrator so the problem remains)
Comment 6 zweibieren 2013-02-01 14:16:53 UTC
My expected behavior is that--even with a non-administrator user--NetBeans can start programs without any confirmation from the user. The user has already given implicit permission by running NetBeans.

The above may be impossible with the current UAC. We have to give the program higher permissions than the user. (Remember the SUID bit in Unix?   http://www.codecoffee.com/tipsforlinux/articles/028.html) Perhaps we go a bit further and restrict NetBeans so it and its spawn can only write into a limited number of directories.  

The issue is political and not technical: What is Microsoft willing to do to avoid making development more difficult than necessary? 

There is a time limit. At some point systems will be entirely 64 bit and "Program Files (x86)" will disappear. At that time the fact that NetBeans cannot execute programs will be a deal-breaker.

All this said, with the current NetBeans-Ant system the problem does seem to be in Ant.  The ANT bug data base has only one entry that mentions UAC: 
   https://issues.apache.org/bugzilla/show_bug.cgi?id=50427
I will add another referring to this current NetBeans bug.