Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 03-04-2005, 05:45 AM   #1
LQ Newbie
Registered: Mar 2005
Posts: 7

Rep: Reputation: 0
Question setting JAVA_HOME

i want to run jakarta tomcat in linux but how to set the JAVA_HOME
i use java that came along with the cd i don't know where the main java directory is CAN ANY ONE HELP so that i can set the path
Old 03-04-2005, 06:40 AM   #2
Registered: Apr 2004
Distribution: Gentoo
Posts: 37

Rep: Reputation: 15
Assuming you're using BASH...

In shell...

$ vi ~/.bashrc

Press 'a' on the keyboard to insert... and type in the following:
# User specific aliases and functions
export PATH
**NOTE: Your path my differ, depending on version and if you have SDK or just JRE. Please go to the /usr/java directory and right down the proper directory name and be sure to add /bin on the end**

Press 'Esc' to stop inserting.
Press ':' to bring up the vi command prompt.
Press 'x' to exit and save.

Now log out of KDE or Gnome and log back in.

In shell...

$ which java

Should return the path to your java install.
Old 03-04-2005, 09:17 PM   #3
Senior Member
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
Type "locate java" and see what is returned. This should give you where java is installed.

Depending on your distro, it is likely to be /usr/local/java, /usr/lib/java or /usr/java.

Then open your ~/.bash_profile with your favourite text editor. Use .bash_profile rather that .bashrc, since .bash_profile is read on login, whereas .bashrc is read each time you open a shell. Add the following lines to .bash_profile:
export JAVA_HOME=/usr/lib/java
export PATH=$JAVA_HOME/bin:$PATH
(assuming that java is in /usr/lib/java. Substitute for where it is on your system)

I hope this helps


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
problem setting JAVA_HOME pkpro1 Linux - General 5 11-25-2007 08:49 AM
Permanently Setting the Java_Home Dynapen Linux - Newbie 2 08-04-2004 01:53 PM
Opera Startup + Setting JAVA_HOME l2g Linux - Newbie 2 03-07-2004 05:43 AM
$JAVA_HOME and $PATH magnum818 Linux - Software 2 09-30-2003 10:05 PM
JAVA_HOME and tomcat mbbender Linux - Software 5 07-07-2003 08:39 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:33 PM.

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