You are not logged in.
I am having a strange phanomenon.
I have jdk7-openjdk installed, but I still have
% echo $JAVA_HOME
/usr/lib/jvm/java-7-openjdk/jre
This is only with my current user. When I try root or a freshly created user, I correctly get
% echo $JAVA_HOME
/usr/lib/jvm/java-7-openjdk
So I guess this is caused by something in my home directory. As 'grep -r JAVA_HOME ~/.*' does not give any hints, I do not know how to investigate this further.
Maybe someone here has any idea how to find out more.
Last edited by cbuehler (2013-12-22 10:20:30)
Offline
welcome to archlinux!
Maybe someone here has any idea how to find out more.
search the wiki, the forums, the web.
Offline
JAVA_HOME is set by jre7-openjdk to /usr/lib/jvm/java-7-openjdk/jre. If one installs jdk7-openjdk, then it gets reset to /usr/lib/jvm/java-7-openjdk. If the JRE is installed first and then the JDK without the proper files being sourced, then JAVA_HOME doesn't get updated. By any chance did you install these seperately and not log off then back in again (or source the proper files)?
Last edited by skottish (2013-12-20 18:42:53)
Offline
@ondoho: Thanks, but I am not really new to Arch, only first post in the forum because I could not find anything useful by searching (mainly because I have no idea what to search for).
I am using Arch for several years, maintain some AUR packages etc. but until now did not have the need to post something on the forum.
@skottish: The installation happened a while ago, and I certainly did log off and on since then (e.g. this morning ). So I guess this should not be the issue.
Maybe someone can give me a hint how to trace when an environment variable gets set?
Offline
Maybe someone can give me a hint how to trace when an environment variable gets set?
/etc/profile.d/
Offline
% cat /etc/profile.d/jdk.sh
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk
% cat /etc/profile.d/jre.sh
export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-openjdk/jre}
# Enable this for non-reparenting window managers
#export _JAVA_AWT_WM_NONREPARENTING=1
But this does not explain why each user except mine are working as expected.
Offline
Are you using the same shell for your regular user as the others?
Offline
Yes, all use zsh as shell.
Offline
You should check exactly what is running /etc/profile.d/*, and how it is enforcing *alphabetical* order
Offline
% grep -r JAVA_HOME /etc/profile.d
/etc/profile.d/jre.csh:setenv JAVA_HOME "/usr/lib/jvm/java-7-openjdk/jre"
/etc/profile.d/jre.sh:export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-openjdk/jre}
/etc/profile.d/jdk.sh:export JAVA_HOME=/usr/lib/jvm/java-7-openjdk
Now I am completely confused: when I change the path in jdk.sh and log in again, JAVA_HOME has the new value. But when I restore the original path, the old behaviour is back (path to jre).
Offline
Please try to understand the difference between a *specified* order and a random order. This would completely explain what you're seeing, due to the definition of RANDOM.
E.g. I use:
for RC in `ls /etc/profile.d/*.{rc,sh}` ; do
# Note we can set the permissions for root-specific scripts
[ -r $RC ] && . $RC
done
And "man ls" says:
Sort entries alphabetically if none of ...
So that's how I get my sorting.
So I repeat, how do YOU ensure that your file processing order is not RANDOM?
Offline
As far as I understand, the order is not important in this case, because jre.sh only overrides JAVA_HOME if it is not set before.
I also like to avoid making configuration changes when it looks like the default config should work fine.
But brebs' reply inspired me to run 'sh -x /etc/profile', which finally shed light into my issue:
...
+++ . /home/cbuehler/Siemens/Teamcenter10.1/Visualization/bin/visviewwebinit /home/cbuehler/Siemens/Teamcenter10.1/Visualization
++++ '[' X_ = X_True ']'
++++ '[' -n /home/cbuehler/Siemens/Teamcenter10.1/Visualization ']'
++++ export EAI_INSTALL=/home/cbuehler/Siemens/Teamcenter10.1/Visualization
++++ EAI_INSTALL=/home/cbuehler/Siemens/Teamcenter10.1/Visualization
++++ '[' -d /usr/lib/jvm/java-7-openjdk/jre -o -h /usr/lib/jvm/java-7-openjdk/jre ']'
++++ export JAVA_HOME=/usr/lib/jvm/java-7-openjdk/jre
++++ JAVA_HOME=/usr/lib/jvm/java-7-openjdk/jre
...
I have Teamcenter Visualization installed in my home directory. And this changes my JAVA_HOME in /home/cbuehler/Siemens/Teamcenter10.1/Visualization/bin/visviewwebinit:
# If JAVA_HOME points to the top level java directory, reset it to point to the JRE directory.
if [ -d $JAVA_HOME/jre -o -h $JAVA_HOME/jre ]; then
#{
export JAVA_HOME=$JAVA_HOME/jre
#}
fi
I commented this part out and now everything works fine.
Thank you very much for your help.
Offline