JAVA_HOME from /etc/profile
THUFIR HAWAT
hawat.thufir at gmail.com
Fri Feb 17 19:02:57 UTC 2006
I'm using Jpackage on FC4 and would like to use cocoon. For reasons
explained on the Jpackage list, Jpackage doesn't set JAVA_HOME (I
don't understand the rationale, but that's a different topic).
Presumably, the best place to set JAVA_HOME is in /etc/profile? I
have about ten different JVM's, apparently. Line's 6 and 54 of
/etc/profile are the same, and are supposed to set the environment
variable. It's kinda working, in that something's being echoed, so
the variable's being set, but Cocoon is still having a problem. I want
all users to have the same JAVA_HOME setting, so don't want to do this
in the local users .bashrc, if possible.
terminal output:
[root at localhost cocoon-2.1.8]# ./cocoon.sh servlet
You must set JAVA_HOME to point at your Java Development Kit installation
[root at localhost cocoon-2.1.8]# echo $JAVA_HOME
/usr/lib/jvm/java
[root at localhost cocoon-2.1.8]# ll /usr/lib/jvm/java/
total 17180
drwxr-xr-x 2 root root 4096 Feb 14 04:05 bin
drwxr-xr-x 3 root root 4096 Feb 14 02:27 include
drwxr-xr-x 6 root root 4096 Feb 14 02:28 jre
drwxr-xr-x 2 root root 4096 Feb 14 02:27 lib
-rw-r--r-- 1 root root 17527615 Nov 10 16:38 src.zip
[root at localhost cocoon-2.1.8]# ll /usr/lib/jvm/java
lrwxrwxrwx 1 root root 26 Feb 14 02:27 /usr/lib/jvm/java ->
/etc/alternatives/java_sdk
[root at localhost cocoon-2.1.8]# ll /usr/lib/jvm/
total 60
lrwxrwxrwx 1 root root 26 Feb 14 02:27 java -> /etc/alternatives/java_sdk
drwxr-xr-x 3 root root 4096 Dec 8 03:06 java-1.4.2-gcj-1.4.2.0
lrwxrwxrwx 1 root root 32 Feb 14 02:27 java-1.5.0 ->
/etc/alternatives/java_sdk_1.5.0
lrwxrwxrwx 1 root root 23 Feb 14 02:27 java-1.5.0-sun ->
java-1.5.0-sun-1.5.0.06
drwxr-xr-x 6 root root 4096 Feb 14 02:28 java-1.5.0-sun-1.5.0.06
lrwxrwxrwx 1 root root 30 Feb 14 02:27 java-sun ->
/etc/alternatives/java_sdk_sun
lrwxrwxrwx 1 root root 21 Dec 8 03:06 jre -> /etc/alternatives/jre
lrwxrwxrwx 1 root root 27 Dec 8 03:06 jre-1.4.2 ->
/etc/alternatives/jre_1.4.2
lrwxrwxrwx 1 root root 26 Dec 8 03:06 jre-1.4.2-gcj ->
java-1.4.2-gcj-1.4.2.0/jre
lrwxrwxrwx 1 root root 27 Feb 14 02:27 jre-1.5.0 ->
/etc/alternatives/jre_1.5.0
lrwxrwxrwx 1 root root 27 Feb 14 02:26 jre-1.5.0-sun ->
java-1.5.0-sun-1.5.0.06/jre
lrwxrwxrwx 1 root root 25 Dec 8 03:06 jre-gcj -> /etc/alternatives/jre_gcj
lrwxrwxrwx 1 root root 25 Feb 14 02:27 jre-sun -> /etc/alternatives/jre_sun
[root at localhost cocoon-2.1.8]# cat /etc/profile -n
1 # /etc/profile
2
3 # System wide environment and startup programs, for login setup
4 # Functions and aliases go in /etc/bashrc
5
6 JAVA_HOME=$(. /usr/share/java-utils/java-functions; set_jvm;
echo $JAVA_HOME)
7
8 pathmunge () {
9 if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
10 if [ "$2" = "after" ] ; then
11 PATH=$PATH:$1
12 else
13 PATH=$1:$PATH
14 fi
15 fi
16 }
17
18 # Path manipulation
19 if [ $EUID = 0 ]; then
20 pathmunge /sbin
21 pathmunge /usr/sbin
22 pathmunge /usr/local/sbin
23 fi
24
25 pathmunge /usr/X11R6/bin after
26
27
28 # No core files by default
29 ulimit -S -c 0 > /dev/null 2>&1
30
31 USER="`id -un`"
32 LOGNAME=$USER
33 MAIL="/var/spool/mail/$USER"
34
35 HOSTNAME=`/bin/hostname`
36 HISTSIZE=1000
37
38 if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
39 INPUTRC=/etc/inputrc
40 fi
41
42 export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
43
44 for i in /etc/profile.d/*.sh ; do
45 if [ -r "$i" ]; then
46 . $i
47 fi
48 done
49
50 unset i
51 unset pathmunge
52
53
54 JAVA_HOME=$(. /usr/share/java-utils/java-functions; set_jvm;
echo $JAVA_HOME)
55
[root at localhost cocoon-2.1.8]# date
Fri Feb 17 13:56:28 EST 2006
[root at localhost cocoon-2.1.8]#
thanks,
Thufir
More information about the fedora-list
mailing list