LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   where to install java ? (https://www.linuxquestions.org/questions/linux-newbie-8/where-to-install-java-360680/)

Volcano 09-06-2005 07:22 AM

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 ?

r0b0 09-06-2005 08:25 AM

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.

halo14 09-06-2005 08:59 AM

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.

Volcano 09-06-2005 09:23 AM

i have installed java . but How do i set the PATH ?

my shell is bash shell.

please tell in steps . i am a newbie.

Volcano 09-06-2005 09:25 AM

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

Volcano 09-06-2005 09:35 AM

>Install it as root either to /usr/local/ or to /opt/

ohh...i have installed in the root ! :cry:

that means other user can not access java ?

r0b0 09-06-2005 01:50 PM

Quote:

Originally posted by Volcano
>Install it as root either to /usr/local/ or to /opt/

ohh...i have installed in the root ! :cry:

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.

Volcano 09-06-2005 07:28 PM

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

IBall 09-06-2005 11:24 PM

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

Volcano 09-07-2005 12:15 AM

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

IBall 09-07-2005 12:25 AM

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

Volcano 09-07-2005 01:25 AM

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 ?

IBall 09-07-2005 02:14 AM

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

Volcano 09-07-2005 02:34 AM

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 ?

IBall 09-07-2005 10:09 PM

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


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