[arch-dev-public] JAVA_HOME in systemd

Guillaume ALAUX guillaume at archlinux.org
Wed Feb 6 09:08:53 EST 2013


On 6 February 2013 15:08, Guillaume ALAUX <guillaume at archlinux.org> wrote:
> ---------- Forwarded message ----------
> From: Leonidas Spyropoulos <artafinde at gmail.com>
> Date: 6 February 2013 14:52
> Subject: Re: [arch-dev-public] JAVA_HOME in systemd
> To: guillaume at archlinux.org
>
>
> On Wed, Feb 6, 2013 at 1:36 PM, Jan Steffens <jan.steffens at gmail.com> wrote:
>> On Wed, Feb 6, 2013 at 1:58 PM, Gaetan Bisson <bisson at archlinux.org> wrote:
>>> You can always have each Java runtime provide a different file, and
>>> include all of them in each Java service file using
>>>
>>>         EnvironmentFile=-/path/to/java/runtime/number/one
>>>         EnvironmentFile=-/path/to/java/runtime/number/two
>>>
>>> etc.
>>
>> You can also pass a wildcard expression, avoiding hardcoding several files,
>> maybe like this:
>>
>> EnvironmentFile=-/etc/java-runtime.d/*
>> EnvironmentFile=-/etc/java-runtime
>>
>> Needs testing, but could allow the user to set a default runtime via symlink.
>>
>> Alternatively, just EnvironmentFile=/etc/java-runtime and create this symlink
>> at post_install of every java-runtime, if it doesn't exist already.
>> To be tidy, post_remove then deletes the file if java-runtime.d
>> doesn't exist anymore.
>
> I can't send to mailing list as I am not a dev / TU.
> Isn't it possible to detect the JDK on runtime? Getting it from the
> java command? (or the javac command)
>
> --
> Caution: breathing may be hazardous to your health.
>
> #include <stdio.h>
> int main(){printf("%s","\x4c\x65\x6f\x6e\x69\x64\x61\x73");}

The point is to enable the user to statically set which JRE must be
used. Detecting it at each java app runtime would not be ideal.

And I'd also rather not have to list all potential JRE in all java
systemd files.

Creating a symlink at post_install if it does not already exist looks
nice to me.


More information about the arch-dev-public mailing list