Re: How do I set different JAVA_HOME for different users?

2016-04-07 Thread Jaimz Fairfax


  From: Thomas Schmitt <scdbac...@gmx.net>
 To: debian-user@lists.debian.org 
 Sent: Wednesday, 6 April 2016, 16:50
 Subject: Re: How do I set different JAVA_HOME for different users?
   
Hi,

Jaimz Fairfax wrote:
> The internet seemed to be convinced that it had to be done via systemd
> user.conf.

That opinion does not have to be wrong.
It depends on the level of software which you want to influence.
Environment variables are a very fundamental feature. Programs can
see them even if they have not been started by a shell. But of course,
the settings in the shell cannot influence what those programs see.
So it is sometimes necessary to use the init software or the desktop
to define the variable names and values for programs.

On the other side ot the spectrum, you may write wrapper programs
around the programs which you want to influence. Those wrappers
would set up the desired environment variables before starting the
desired program.
In the most simple case this would be a shell script like

  #!/bin/sh

  export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"

  android-emulator ...options...

So you can set up different environments per program rather than per
user.


Have a nice day :)

Thomas

Thomas,A shell script exactly like that was what what I started out with!It 
worked ONLY for that terminal. 
I have seen a lot references to wrapper scripts but no examples for me to 
follow.I never thought to try 'man bash'.I did 'man environment' which returned 
nothing...The trouble is, often you need to know where to look, and if you know 
where to look you probably know the answer anyway.
Jaimz



  

Re: How do I set different JAVA_HOME for different users? SOLVED

2016-04-06 Thread Jaimz Fairfax


  From: Thomas Schmitt 
 To: debian-user@lists.debian.org 
 Sent: Wednesday, 6 April 2016, 9:59
 Subject: Re: How do I set different JAVA_HOME for different users?
  I have most of my personal preferences in ~/.bashrc .Stuff like:

  export LC_COLLATE="C"
  export HISTCONTROL="ignoredups"
  export PS1='\u@\h:\W> '

So i guess it would be a good place to set

  export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
Have a nice day :)

Thomas

Thanks for that!
Adding 
 export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"to the end of ~/.bashrc 
fixed it.The internet seemed to be convinced that it had to be done via systemd 
user.conf.



  

How do I set different JAVA_HOME for different users?

2016-04-06 Thread Jaimz Fairfax
I am running debian unstable, systemd version 229.I am learning Android 
development. 
Android Studio uses JAVA_HOME = /usr/java/jdk1.8.0_66.Some of the code I want 
to investigate uses Apache maven and that wants 
JAVA_HOME = /usr/lib/jvm/java-8-openjdk-amd64
I setup user2 so that when logging in JAVA_HOME is automatically set for 
maven.Except nothing I try will make it work.export 
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64" works in a terminal, but only for 
that terminal.
The internet thinks that /home/user2/.config/systemd/user.conf 
withDefaultEnvironment=JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64will work. It 
doesn't.
Thanks, Jaimz