on ‎2010 Sep 20 1:18 PM
Dear sir,
I would like to install ECC.6 on Red Hat Enterprises Linux 5.0 server for test purpose. I have already completed RHEL installation and perform all the recommendation written in SAP NOTES 171356, 1048303 etc.
I have installed JAVA as per the instructions given in the following links.
http://java.sun.com/j2se/1.4.2/install-linux.html
http://www.java.com/en/download/help/linux_install.xml
http://www.yolinux.com/TUTORIALS/LinuxTutorialJava.html#INSTALL_SDK
I am able to install JAVA on my Linux server but when I try to check whether the installation is successful or not I tried following commands, with the unexpected result.
#which java
/usr/bin/java
Java -fullversion*
gives details of by default installed java.
Can anybody help me or guide me to install java correctly on my Linux server?
Any other details if you like I will provide.
Regards
Ahsan
Help others by sharing your knowledge.
AnswerRequest clarification before answering.
This message was moderated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I have installed java on Linux by exactly performing your steps given, however when check the JAVA -Version it still says no java installed.
Detailed output.
-
[root@localhost /]# which java
/usr/bin/java
[root@localhost /]# java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20070626 (Red Hat 4.1.2-14)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@localhost /]# ls -ltr
total 70406
-rw-rr 1 root root 35513469 May 10 2006 j2sdk-1_4_2_12-linux-i586.rpm
drwxr-xr-x 2 root root 4096 Oct 11 2006 srv
drwxr-xr-x 2 root root 4096 Oct 11 2006 opt
drwxr-xr-x 2 root root 4096 Oct 11 2006 mnt
drwxr-xr-x 2 root root 4096 Oct 11 2006 home
-rwxrwxrwx 1 root root 36337163 Sep 20 18:09 j2sdk-1_4_2_12-linux-i586.bin
drwx------ 2 root root 16384 Sep 24 22:18 lost+found
drwxr-xr-x 3 root root 4096 Sep 24 22:20 sapmnt
drwxr-xr-x 3 root root 4096 Sep 24 22:21 oracle
drwxr-xr-x 2 root root 4096 Sep 24 22:22 selinux
drwxr-xr-x 15 root root 4096 Sep 24 22:25 usr
drwxr-xr-x 4 root root 1024 Sep 24 22:26 boot
drwxr-xr-x 2 root root 4096 Sep 24 22:27 bin
drwxr-xr-x 14 root root 4096 Sep 24 22:27 lib
drwxr-xr-x 21 root root 4096 Sep 24 22:29 var
drwxr-xr-x 2 root root 12288 Sep 24 22:31 sbin
dr-xr-xr-x 141 root root 0 Sep 24 22:34 proc
drwxr-xr-x 11 root root 0 Sep 24 22:34 sys
drwxr-xr-x 2 root root 0 Sep 24 22:34 misc
drwxr-xr-x 2 root root 0 Sep 24 22:34 net
drwxr-xr-x 11 root root 4320 Sep 24 22:43 dev
drwxr-xr-x 3 root root 4096 Sep 24 22:45 media
drwxr-xr-x 4 root root 4096 Sep 24 22:46 dump
drwxr-xr-x 91 root root 4096 Sep 24 22:46 etc
drwxrwxr-x 9 root root 4096 Sep 24 22:57 j2sdk1.4.2_12
drwxrwxrwt 11 root root 4096 Sep 24 22:58 tmp
drwxr-x--- 15 root root 4096 Sep 24 22:58 root
[root@localhost /]# chmod 777 j2sdk-1_4_2_12-linux-i586.rpm
[root@localhost /]# rpm -Uvh j2sdk-1_4_2_12-linux-i586.rpm
Preparing... ########################################### [100%]
1:j2sdk ########################################### [100%]
[root@localhost /]# which java
/usr/bin/java
[root@localhost /]# java -fullversion
java full version "gcj-1.4.2"
[root@localhost /]# alternatives --config java
There is 1 program that provides 'java'.
Selection Command
-
*+ 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
Enter to keep the current selection[+], or type selection number:
[root@localhost /]# ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 Sep 24 22:28 /usr/bin/java -> /etc/alternatives/java
[root@localhost /]# echo $JAVA_HOME
[root@localhost /]#
-
Regards
Ahsan
Edited by: Ahsan Rizvi on Sep 30, 2010 7:29 AM
Dear Eric,
I have already set environment variable JAVA_HOME.
[root@localhost /]# export JAVA_HOME=/usr/java/j2re1.4.2_12/bin
[root@localhost /]# export PATH=$PATH:/usr/java/j2re1.4.2_12
However the result is below.
root@localhost /# which java
/usr/bin/java
root@localhost /# java -fullversion
java full version "gcj-1.4.2"
Please correct me if I'm not understanding anything.
Warm Regards
Ahsan
Dear Ahsan,
the reason behind Deepak suggestion is, that the $PATH variable checks the path from the first given directory to the last given directory. If you place the /usr/java/j2re1.4.2_12 path at the end of the $PATH variable, if will still use a java that is found earlier in the path. Therefore, make sure that /usr/java/j2re1.4.2_12 comes first. With this you ensure that this directory is searched first.
Basically, $PATH variables are very basics in IT and work the same on Windows and UNIX systems. It is quite strange that you bypassed this concept until now
Thanks, Hannes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.