[Live-demo] Where should JAVA_HOME be set (if overriding default=openjdk 1.7)?

Hamish hamish_b at yahoo.com
Fri Jan 13 12:51:14 PST 2012


Cameron wrote:
> By splitting the java migration between two
> releases, we hopefully should be able to build
> up experience with the early adopter projects in
> osgeolive5.5, then draw upon that experience when
> migrating the others in osgeolive6.0.

fair enough, if the disc space allows.
what is the reason not to use Natty's packaged
version of openjdk? (6b22-1.10.4-0ubuntu1~11.04.1)
custom modifications to basic infrastructure is a
major major headache and not having to deal with
those problems far outweighs access to the latest
shiny in cases where access to the latest shiny is
not critical.

> I wonder whether it would be possible to set up a
> little gui widget which switches the JAVA_HOME
> between openjdk and sun-java. This could be used
> by testers to turn on openjdk and find out if
> applications work or not.

Not generally possible to do it system wide on the
ISO; possible on the VM but it requires a reboot.
/etc/profile.d/set_JAVA_HOME.sh would need to be
edited with `sed -i` (or simply replaced).

It is not possible to change an environment variable
in the parent process from a child or sibling
process. Inheritance only goes in one direction.


It would be possible to override the system-wide
setting by putting a second setting of JAVA_HOME in
/home/user/.profile but that would still require
the user to log back out and in.

e.g.:
if [ `grep -c JAVA_HOME ~/.profile` -eq 0 ] ; then
   echo "export JAVA_HOME=$new" >> ~/.profile
else
   sed -i -e 's+JAVA_HOME=.*+JAVA_HOME=$new+' ~/.profile
fi


Hamish




More information about the Osgeolive mailing list