Re: JAVA_HOME in pbuilder
On 2013-06-30 10:25, olivier.sallou@codeless.fr wrote:
> Hi,
> I have an issue building a package with pbuilder.
>
> Package builds fine with dpkg-buildpackage, but when ran with pbuilder,
> it seems JAVA_HOME is lost.
>
pbuilder usually involves a sudo and that can clear (most of) the ENV
> The ant build file makes use of JAVA_HOME env property, and fails
> because it does not find something in JAVA_HOME.
>
> I make use of java helper:
>
> %:
> dh $@ --with javahelper
>
>
> If I set JAVA_HOME myself in debian/rules (JAVA_HOME=$(readlink -f
> /usr/bin/javac | sed "s:/bin/javac::")), it works with:
> debian/rules binary
> but not with dpkg-buildpackage, JAVA_HOME is seen as empty (which is
> weird as command looks at file location).
>
You are missing "export JAVA_HOME". Also, we recommend that you set
JAVA_HOME to a known value to get a consistent build, e.g.
export JAVA_HOME:=/usr/lib/jvm/default-java
(with a Build-Depends: default-jdk). But you should definitely
set/export JAVA_HOME in d/rules if your build uses that variable. In
particularly, relying on the user to set a variable for the build to
work is not permitted for (official) Debian pacakges.
> Any idea of what is going on in pbuilder env?
>
> Thanks
>
> Olivier
>
~Niels
Reply to: