LinuxQuestions.org
Visit Jeremy's Blog.
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 03-04-2005, 05:45 AM   #1
gauravbagga
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
gt_swagger
Member
 
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:
Code:
# User specific aliases and functions
PATH=$PATH:/usr/java/j2sdk1.4.2_06/bin
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
IBall
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:
Code:
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
--Ian
 
  


Reply


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

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

All times are GMT -5. The time now is 05:11 AM.

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