LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-01-2010, 02:34 AM   #1
ytd
Member
 
Registered: Jan 2009
Posts: 205

Rep: Reputation: 31
How To Install Java on LINUX and set the path variable


I have downloaded java and installed it with chmod +x and then ./bin package.

Hereunder is an output from CLI (putty)

root@hercule:/jre1.6.0_21#
root@hercule:/jre1.6.0_21# whereis java
java: /usr/share/java
root@hercule:/jre1.6.0_21#
root@hercule:/jre1.6.0_21# java -version
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) Client VM (build 17.0-b16, mixed mode, sharing)
root@hercule:/jre1.6.0_21#
root@hercule:/jre1.6.0_21# pwd
/jre1.6.0_21
root@hercule:/jre1.6.0_21# ls
bin COPYRIGHT javaws lib man plugin README THIRDPARTYLICENSEREADME.txt Welcome.html
root@hercule:/jre1.6.0_21# cd bin
root@hercule:/jre1.6.0_21/bin# ls
ControlPanel java_vm jcontrol orbd policytool rmiregistry tnameserv
java javaws keytool pack200 rmid servertool unpack200
root@hercule:/jre1.6.0_21/bin# export JAVA_HOME=/jre1.6.0_21/bin/java
root@hercule:/jre1.6.0_21/bin# export PATH=$PATH:/jre1.6.0_21/bin/
root@hercule:/jre1.6.0_21/bin#
root@hercule:/jre1.6.0_21/bin# whereis java
java: /usr/share/java
root@hercule:/jre1.6.0_21/bin#
root@hercule:/jre1.6.0_21/bin# java -version
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) Client VM (build 17.0-b16, mixed mode, sharing)
root@hercule:/jre1.6.0_21/bin#
root@hercule:/jre1.6.0_21/bin# cd /
root@hercule:/# cd apache-tomcat-6.0.29
root@hercule:/apache-tomcat-6.0.29# cd bin
root@hercule:/apache-tomcat-6.0.29/bin# ls
bootstrap.jar commons-daemon-native.tar.gz setclasspath.sh tomcat-juli.jar version.sh
catalina.bat cpappend.bat shutdown.bat tomcat-native.tar.gz
catalina.sh digest.bat shutdown.sh tool-wrapper.bat
catalina-tasks.xml digest.sh startup.bat tool-wrapper.sh
commons-daemon.jar setclasspath.bat startup.sh version.bat
root@hercule:/apache-tomcat-6.0.29/bin# ./catalina.sh start
Using CATALINA_BASE: /apache-tomcat-6.0.29
Using CATALINA_HOME: /apache-tomcat-6.0.29
Using CATALINA_TMPDIR: /apache-tomcat-6.0.29/temp
Using JRE_HOME: /jre1.6.0_21/bin/java
Using CLASSPATH: /apache-tomcat-6.0.29/bin/bootstrap.jar
root@hercule:/apache-tomcat-6.0.29/bin#
root@hercule:/apache-tomcat-6.0.29/bin# ./catalina.sh stop
Using CATALINA_BASE: /apache-tomcat-6.0.29
Using CATALINA_HOME: /apache-tomcat-6.0.29
Using CATALINA_TMPDIR: /apache-tomcat-6.0.29/temp
Using JRE_HOME: /jre1.6.0_21/bin/java
Using CLASSPATH: /apache-tomcat-6.0.29/bin/bootstrap.jar
./catalina.sh: 454: /jre1.6.0_21/bin/java/bin/java: not found
root@hercule:/apache-tomcat-6.0.29/bin#


I understand that the system knows the java is in a wrong place but if I do java -version it finds it correctly. I don't know and I don't understand how do I need to tell the OS that the java is somewhere else, I just did that with export java home and java path but still dosen't work, it keep tells when I do whereis java "java: /usr/share/java"

how do I fix this? What do I need to do?

here is another output that might help:

root@hercule:/apache-tomcat-6.0.29/bin# env
TERM=xterm
SHELL=/bin/bash
XDG_SESSION_COOKIE=c150847861d850d6cd1b3a8f4b928342-1285914536.524992-1521617382
SSH_CLIENT= edited 58695 edited
OLDPWD=/apache-tomcat-6.0.29
SSH_TTY=/dev/pts/0
USER=root
LS_COLORS=rs=0:di=01;34:ln=01;36:hl=44;37i=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01r=40;3 1;01:su=37;41:sg=30;43:ca=30;41:tw=30;42w=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01 ;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.bz2 =01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;3 1:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*. pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png =01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=0 1;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35 :*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.g l=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01; 35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36: *.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
MAIL=/var/mail/root
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$/jre1.6.0_21/bin:/jre1.6.0_21/bin:/jre1.6.0_21/bin/:/jre1.6.0_21/bin/
PWD=/apache-tomcat-6.0.29/bin
JAVA_HOME=/jre1.6.0_21/bin/java
LANG=en_US.UTF-8
SPEECHD_PORT=6560
SHLVL=1
HOME=/root
LOGNAME=root
SSH_CONNECTION=edited
LESSOPEN=| /usr/bin/lesspipe %s
LESSCLOSE=/usr/bin/lesspipe %s %s
_=/usr/bin/env
root@hercule:/apache-tomcat-6.0.29/bin#

Last edited by ytd; 10-01-2010 at 02:37 AM.
 
Old 10-01-2010, 03:36 AM   #2
pinga123
Member
 
Registered: Sep 2009
Posts: 684
Blog Entries: 2

Rep: Reputation: 37
Just follow the step 2 and step 3in below blog you should be done.
just ignore tomcat installation part.

http://learnlinuxwithrohan.blogspot....h/label/Tomcat

Last edited by pinga123; 10-01-2010 at 03:41 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
set up java_home path in /home/user/.bashrc but use path in /usr/lib/java vitalstrike82 Slackware 4 01-13-2009 11:25 PM
How to set PATH How do I set PATH environment variable? Tranquil Linux - Newbie 3 11-02-2003 02:52 AM
set up path,classpath in linux(slaware9) for java Manjula.S Linux - Software 5 10-06-2003 11:38 PM
how to rum java on linux and set path for the same mita_majumdar Linux - Newbie 2 06-02-2003 12:50 AM
how to rum java on linux and set path for the same mita_majumdar Linux - Newbie 1 05-26-2003 03:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration