LinuxQuestions.org
Visit Jeremy's Blog.
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 09-06-2005, 07:22 AM   #1
Volcano
Member
 
Registered: Sep 2005
Posts: 225

Rep: Reputation: 15
where to install java ?


To which directory i should install jdk 1.4?

i am both the root and the user .

which directory i should install java ?

suppose, i install jdk1.4 in root. directory.. ..now if i log in as a user "user " will i able to access java ?


similarly, if i install jdk1.4 in "user " directory , will i able to access java when i log in as root ?

i am confused where to install java whether in root directory or in user directory .

any help ?


i also, want to install tomcat too. where do i install that also ?

Last edited by Volcano; 09-06-2005 at 07:24 AM.
 
Old 09-06-2005, 08:25 AM   #2
r0b0
Member
 
Registered: Aug 2004
Location: Europe
Posts: 608

Rep: Reputation: 50
Install it as root either to /usr/local/ or to /opt/

You will be able to use it as both root and user, no problem.
 
Old 09-06-2005, 08:59 AM   #3
halo14
Senior Member
 
Registered: Apr 2004
Location: Surprise, AZ
Distribution: Debian | CentOS | Arch
Posts: 1,103

Rep: Reputation: 45
You can probably get it for your distrobution, which you should supply. Then someone can probably point you to a pre-built package of java for your.
 
Old 09-06-2005, 09:23 AM   #4
Volcano
Member
 
Registered: Sep 2005
Posts: 225

Original Poster
Rep: Reputation: 15
i have installed java . but How do i set the PATH ?

my shell is bash shell.

please tell in steps . i am a newbie.
 
Old 09-06-2005, 09:25 AM   #5
Volcano
Member
 
Registered: Sep 2005
Posts: 225

Original Poster
Rep: Reputation: 15
my java has been installed in directory

/usr/java/jdk1.5.0_04


i am getting difficulty to set the PATH . how to set the PATH ?

i want to compile HelloWorld.java.

please help me.

Regrds
Volcano
 
Old 09-06-2005, 09:35 AM   #6
Volcano
Member
 
Registered: Sep 2005
Posts: 225

Original Poster
Rep: Reputation: 15
>Install it as root either to /usr/local/ or to /opt/

ohh...i have installed in the root !

that means other user can not access java ?
 
Old 09-06-2005, 01:50 PM   #7
r0b0
Member
 
Registered: Aug 2004
Location: Europe
Posts: 608

Rep: Reputation: 50
Quote:
Originally posted by Volcano
>Install it as root either to /usr/local/ or to /opt/

ohh...i have installed in the root !

that means other user can not access java ?
Don't panic

Everything will be ok. You can set your PATH to the java binaries and all users will be able to use it.

Become root by using su. Then make a link with a nice name to your new installation of java, for example like this:

Code:
ln -s /usr/java/jdk1.5.0_04 /usr/local/jdk
Then open file /etc/profile as root in a text editor and add this line to the end of the file:

Code:
export PATH=$PATH:/usr/local/jdk/bin
Log out and log in again and you should be able to run javac.

R.
 
Old 09-06-2005, 07:28 PM   #8
Volcano
Member
 
Registered: Sep 2005
Posts: 225

Original Poster
Rep: Reputation: 15
hi,

my my java has been installed in directory

/usr/java/jdk1.5.0_04.



i have some question on your comment.

Question1 :

Quote:
Then make a link with a nice name to your new installation of java, for example like this:

ln -s /usr/java/jdk1.5.0_04 /usr/local/jdk

but inside /usr/local/ there is no jdk folder ! .....do you mean i should create jdk folder there first before executing your code ? i dont like this name jdk , i want to create a folder java instead of jdk .

and want to run
ln -s /usr/java/jdk1.5.0_04 /usr/local/java

is there any problem ? will i face any problem later on ?


Question 2:


Quote:
Then open file /etc/profile as root in a text editor and add this line to the end of the file:

but how do open that file ?

[root@machineroot]#vi /etc/profile ===>this does not work.

i am also surprised that the file has no extenstion ! is it profile.txt ?



Please help, i am a very much newbie.....so please bear with this silly questions.

All i need is to install java.

Regards
 
Old 09-06-2005, 11:24 PM   #9
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
1)
Code:
ln -s /usr/java/jdk1.5.0_04 /usr/local/java
This command will be fine. Just make sure that you use /usr/local/java not /usr/local/jdk.
What you are doing is creating a Symbolic Link (Shortcut) with a nice name to /usr/java/jdk1.5.0_04. This step is optional, you only need to do it if you want. You are NOT creating a new folder, just a shortcut to an existing one.

2)
Code:
[root@machineroot]#vi /etc/profile
This does not work. It should do, what error message do you get. Remember that Linux is Case Sensitive - /ETC/PROFILE is not the same as /etc/profile. The correct one is lower case.

It does not have an extension, many files in linux don't have extensions.


I hope this helps, and post back with any further problems
--Ian
 
Old 09-07-2005, 12:15 AM   #10
Volcano
Member
 
Registered: Sep 2005
Posts: 225

Original Poster
Rep: Reputation: 15
Sir, hurrah...it started working !



sir ,if I copy the whole jdk1_5_04 from /usr/java directory and pasted into /usr/local directory will that work ? please tell me.

thank you
 
Old 09-07-2005, 12:25 AM   #11
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
Yes, but you would need to change your PATH, as you already have done.

Why bother though? There is no real benefit to be gained from this.

I hope this helps
--Ian
 
Old 09-07-2005, 01:25 AM   #12
Volcano
Member
 
Registered: Sep 2005
Posts: 225

Original Poster
Rep: Reputation: 15
Sir,
if i did not do symbolic link

ln -s /usr/java/jdk1.5.0_04 /usr/local/jdk


but only....

typed export PATH=$PATH:/usr/java/jdk1.5.0_04/bin

does not everybody could access java ?

i guess all user could access java because i am setting the PATH here. there is no need to do symbolic link. is not it ?

but in the first response, somebody told your java could be accessed if you install in/usr/local directory !......its meaningless.what the speciality this folder(/usr/local)posses so that all application software should be available here for accessible to everybody ?

Last edited by Volcano; 09-07-2005 at 01:39 AM.
 
Old 09-07-2005, 02:14 AM   #13
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
Yes, there is no need for the symbolic link, you can just add the jdk1.5... directory to your path.

Traditionally, programs that you install yourself are installed to /usr/local. There is nothing special about this, except the permissions will allow all users to read or execute files stored there. If you install to a users home, only that user can access the file.

You can also install programs to /usr/lib, or /opt, but /usr/local is normally used for programs you install manually, while /usr/lib is normally used for programs installed by a package manager (rpm, apt-get, etc).

See The File Heirachy Standard for more if you are interested.

I hope this helps
--Ian
 
Old 09-07-2005, 02:34 AM   #14
Volcano
Member
 
Registered: Sep 2005
Posts: 225

Original Poster
Rep: Reputation: 15
Quote:
Traditionally, programs that you install yourself are installed to /usr/local
thats a very surprising thing to me .

you know i typed


[root@machine root]#rpm -ivh jdk_1_5.....rpm

and my file jdk_1_5... goes into /usr/java/jdk_1_5...... is not it starnge ? IT SHOULD HAVE BEEN GONE TO /usr/local by default as you told . but it did not !



Of couurse, i logged as root and then i downloaded the java and hen installed .


do you suggest i should logged in as a user and then i should use su to be root for installation . if i did that then did my file goes into /usr/local ?

Last edited by Volcano; 09-07-2005 at 02:35 AM.
 
Old 09-07-2005, 10:09 PM   #15
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
No, no, no.

When you install a program using rpm, it will install to other locations, such as /usr/lib (Or in this case /usr/java). Programs you install yourself (using a bin file, such as firefox) are normally installed to /usr/local. It really doesn't matter though, it is mainly just established practice.

--Ian
 
  


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
java does not install in opt but install in usr bbmak Linux - Software 6 10-02-2005 11:13 PM
what directory is java install? what CMD determined where java is install? Thks. suse2166 Linux - Newbie 2 09-04-2005 08:24 PM
why can't i install Java , please help waheedrafiq Linux - Software 11 12-03-2003 01:10 PM
how to install java? Txlyo Red Hat 2 11-06-2003 10:16 AM
Java install doralsoral Linux - Software 10 09-19-2003 10:53 AM

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

All times are GMT -5. The time now is 03:00 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