Gentoo Archives: gentoo-user

From: "Jörg Schaible" <joerg.schaible@×××××××××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: Switching current java-vm for a single application
Date: Wed, 03 Feb 2016 07:11:39
Message-Id: n8s96o$qpv$1@ger.gmane.org
In Reply to: [gentoo-user] Switching current java-vm for a single application by Leonardo Guilherme
1 Hi Leonard,
2
3 Leonardo Guilherme wrote:
4
5 > Hello.
6 >
7 > I'm using OpenJDK JVM regularly on my machine instead of Oracle's one,
8 > primarily because of the infinality patches and because I prefer open
9 > source software.
10 >
11 > There are some applications, though, that do not play ball with it
12 > (namely, SenchaCmd) and I have to keep switching back and forth between
13 > installed java-vms just to run it.
14 >
15 > I know nothing about Java or its environment, is there a way to specify
16 > the java-vm just for this application instead of doing "eselect java-vm
17 > set user 1; sencha *stuff*; eselect java-vm set user 3" everytime?
18 >
19 > Is there a set of environment variables that can do this? Shall I wrap the
20 > command in a shell script? Ideas?
21
22 Either the application uses already a script to start and you can modify
23 JAVA_HOME there or you may wrap it in a shell script. Simply set JAVA_HOME
24 using Gentoo's java-config command:
25
26 ========= %< ==========
27 #! /bin/bash
28 JAVA_HOME=`java-config --select-vm=oracle-jdk-bin-1.8 -o` command
29 ========= %< ==========
30
31 The option -o prints the JRE home, see the --help option to see
32 alternatives.
33
34 The selection name is the name used in eselect, so you may update the
35 package without touching the script.
36
37 Cheers,
38 Jörg