Netbeans active packaging on ubuntu - dpkg not found

1.8k views Asked by At

I want to package my java application as a Debian Package. I'm using the build-in native packager of netbeans(8.0.1) for Deb-Packages

Following output after packing: Execute failed: java.io.IOException: Cannot run program "command" (in directory

"/home/testuser/Songs"): error=2, No such file or directory /home/testuser/Songs/nbproject/jfx-impl.xml:3415: The following error occurred while executing this line: /home/testuser/Songs/nbproject/jfx-impl.xml:3584: Error: JavaFX native packager requires Debian Packager tools to create DEB package, but dpkg could not be found. BUILD FAILED (total time: 1 second)

I have installed the dpkg-dev with apt-get. the $PATH variable contains /usr/bin

I don't know how to fix that problem. anyone has an idea why netbeans does not find dpkg?

2

There are 2 answers

0
Mauro Ziliani On BEST ANSWER

I solved the problem overriding the target -check-dpkg-presence define in nbproject/jfx-impl.xml.

The original target looks for "command" file in the project folder. The row check the real path of dpkg. Running command -v dpkg you get /usr/bin/dpkg.

This is the same beavoiur you get if you try the line

which dpkg ==> /usr/bin/dpkg

So i do this in build.xml

<target name="-check-dpkg-presence" depends="-check-native-bundling-type" if="need.dpkg.presence">
        <local name="exec.which.dpkg.result"/>
        <local name="exec.which.dpkg.output"/>
        <exec executable="which" failifexecutionfails="false" failonerror="false" resultproperty="exec.which.dpkg.result" outputproperty="exec.which.dpkg.output">
            <arg line="dpkg"/>
        </exec>
        <condition property="missing.dpkg">
            <not><and>
                <isset property="exec.which.dpkg.result"/>
                <equals arg1="${exec.which.dpkg.result}" arg2="0"/>
                <isset property="exec.which.dpkg.output"/>
                <not><equals arg1="${exec.which.dpkg.output}" arg2=""/></not>
            </and></not>
        </condition>
    </target>

I change the attribute (executable='which') and the line attribute of the arg tag.

And it works.

2
aizuchi On

If you try running ant -v build-native in your project directory, you'll see the error. The ant build script created by NetBeans is trying to run command dpkg ... to build the package, but since "command" is a built-in shell command in /bin/bash, the test for "command" in your PATH fails.

I created a shell script named "command" in my local path with this:

#!/bin/bash
command $@

which works fine.