Wednesday 15 June 2011

java - Get netbeans to run my project with sudo? -


I am working on a project in Netbeen for which the running project requires root privilege.

I want every time that I push the "Run Project" (F6), my project is run as root, so with the equivalent of "Geckado Javac Maine" Because there is a GUI in it.

One option is to start with NetNeans with root privileges, easily by editing the shortcut "Gaxdo Netbeen". But as I have many projects in Netbeen, this means that for every project I should run Netbeen with basic rights, this is not what I need.

Another option, of course, just open my project, but it is not ideal either.

I think these projects are possible by changing the build.xml file, but I am having trouble finding out how

after some research it would seem that this An Apache ant question is, I have access to build.xml, which I can modify so that I need to know how ant can sudo / gksudo your project However, I can not understand how to do this or if it is possible.

It is believed that a "Java SE" project (such as a web app or Ruby First, stop compiling on Save as a compilation in Project Properties

Second, add build.xml to:

  Lt; Target name = "-init-macrodef-java" & gt; & Lt; Macrodef name = "java" uri = "http://www.netbeans.org/ns/j2se-project/1" & gt; & Lt; Attribute default = "$ {main.class}" name = "classname" /> & Lt; Attribute default = "$ {run.classpath}" name = "classpath" /> & Lt; Element name = "customize" option = "true" /> & Lt; Sequential & gt; & Lt; Exec executable = "gksudo" failonerror = "true" & gt; & Lt; Arg value = "-" /> & Lt; Arg value = "java" /> & Lt; Arg value = "- classpath" /> & Lt; Arg path = "@ {classpath}" /> & Lt; Arg line = "$ {run.jvmargs}" /> & Lt; Arg value = "@ {classname}" /> & Lt; / Executive & gt; & Lt; / Sequential & gt; & Lt; / Macrodef> & Lt; / Target & gt;  

There are other things that you can fix but you should be enough to get it started.


No comments:

Post a Comment