Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 209997 - Java environment variables are only set on interactive shells
Summary: Java environment variables are only set on interactive shells
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Java (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-13 13:29 UTC by Marcel Meckel
Modified: 2009-03-06 06:28 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel Meckel 2008-02-13 13:29:30 UTC
As pointed out in $summary Java env variables are only set in interactive shells.

This is especially problematic if you want to run java apps via ssh, e.g. restart a tomcat server via nagios event handler.

Example:


---snip---
user@local:~>ssh remote 'env | grep JAVA'
Password: 

user@local:~>ssh remote
Password: 
user@remote:~>env|grep JAVA
JAVA_HOME=/etc/java-config-2/current-system-vm
JAVAC=/etc/java-config-2/current-system-vm/bin/javac
user@remote:~>
---snip---


Java env variables are set in

  /etc/profile.d/java-config-2.sh

which is only sourced from /etc/profile but not /etc/bash/bashrc.

Maybe it's worth thinking about moving the code block


---snip---
for sh in /etc/profile.d/*.sh ; do
        if [ -r "$sh" ] ; then
                . "$sh"
        fi
done
unset sh
---snip---


from /etc/profile to /etc/bash/bashrc.
Comment 1 Petteri Räty (RETIRED) gentoo-dev 2009-03-06 06:28:48 UTC
Nothing written by the team should rely on JAVA_HOME so if you you find something that does please open separate bugs for them.