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 240981 - Allowing a command "prefix" before 'remote.java.executable'
Summary: Allowing a command "prefix" before 'remote.java.executable'
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-26 18:59 UTC by joe380
Modified: 2014-07-09 02:47 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Screenshot (31.78 KB, image/png)
2014-07-08 08:02 UTC, Tomas Zezula
Details

Note You need to log in before you can comment on or make changes to this bug.
Description joe380 2014-01-26 18:59:01 UTC
In netbeans it's possible to define a remote java se. (ex. raspberry pi)
After that in file: remote-platform-impl.xml are specified these properties and targets:

PROPERTY:
<property name="remote.java.executable" value="${remote.platform.home.dir}/bin/java"/>

TARGETS:
- '-copy-to-remote-platform'
- 'runwithkey'

In both targets there is an sshexec tag for executing the project on remote host:
<sshexec host="${remote.platform.host}" port="${remote.platform.port}" username="${remote.platform.user}" password="${remote.platform.password}" trust="true" usepty="true"
                    command="cd '${remote.project.dir}'; '${remote.java.executable}' @{additionaljvmargs} -Dfile.encoding=${runtime.encoding} ${run.jvmargs} ${run.jvmargs.ide} -jar ${remote.dist.jar} ${application.args}"/>

The problem comes if you would like to use some libraries which need admin rights.
(ex. sudo java -cp pi4j-core.jar)

So the idea/feature would be to be able to specify a prefix command:
(in the example below it's the SUDO command)
<sshexec host="${remote.platform.host}" port="${remote.platform.port}" username="${remote.platform.user}" password="${remote.platform.password}" trust="true" usepty="true"
                    command="cd '${remote.project.dir}'; SUDO '${remote.java.executable}' @{additionaljvmargs} -Dfile.encoding=${runtime.encoding} ${run.jvmargs} ${run.jvmargs.ide} -jar ${remote.dist.jar} ${application.args}"/>
Comment 1 Tomas Zezula 2014-01-28 14:56:59 UTC
Yes, makes sense.
However to late for NB 8.0 which is already feature frozen.
Comment 2 Tomas Zezula 2014-07-08 08:01:54 UTC
Fixed jet-main 7e9149c22d06.
Added "Exec Prefix" into the Platform properties where you can add sudo, see attached screenshot.
Also you need to add your account to /etc/sudoers on the Pi to prevent sudo from asking for password, something like this:

tzezula ALL=(ALL) NOPASSWD: ALL
Comment 3 Tomas Zezula 2014-07-08 08:02:54 UTC
Created attachment 147928 [details]
Screenshot
Comment 4 Quality Engineering 2014-07-09 02:47:06 UTC
Integrated into 'main-silver', will be available in build *201407090001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/7e9149c22d06
User: Tomas Zezula <tzezula@netbeans.org>
Log: #240981:Allowing a command "prefix" before 'remote.java.executable'