This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Linux / UNIX and the fly likes Installing JDK on Linux. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Installing JDK on Linux." Watch "Installing JDK on Linux." New topic
Author

Installing JDK on Linux.

Garandi Garandi
Ranch Hand

Joined: Jan 07, 2003
Posts: 192
Hi,
I have downloaded, J2sdk from java.sun.com site. There are 2 of them one ends with rpm and the other ends eith bin. In order to install jdk on my linux box, which one should I install and how to install it?(what command should I use to install it) ./jkd(fileName).bin did not work; moreove I also tried the one which ends with rpm too.
Thank you in advance
Garandi
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
In order to run the .bin installer, you first need to give the file execution rights:
chmod a+x *.bin

I usually use the .bin installer. The other option, the .rpm file, has been packaged in the RPM format which is a package management "standard" some of the Linux distributions use. RPM allows you to keep track of what's installed on your Linux, upgrade individual packages, or uninstall them.

RPM is quite easy to use (just say "rpm -i myfile.rpm" and it'll install, rpm -e myfile" and it'll uninstall) but sometimes you'd like to get more control over where the installed pieces go in your filesystem.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Garandi Garandi
Ranch Hand

Joined: Jan 07, 2003
Posts: 192
I did the following "rpm -i j2sdk-1_4_2_06-linux-i586.rpm". but don't know where did it install java and how to add it to my path?
Thank you in advance
Garandi
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
type "which java" on a commandprompt. It should give you the installation path.

Your path is typically set in .profile in your home directory (or in /etc/profile for global settings if memory serves) though this can be different for different shells.


42
Garandi Garandi
Ranch Hand

Joined: Jan 07, 2003
Posts: 192
Thank you for your reply. I did use "which java" and that is what I got.
Thank you in advance
Garandi
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
What distro are you running? You may want to try "locate java".

Layne


Java API Documentation
The Java Tutorial
Garandi Garandi
Ranch Hand

Joined: Jan 07, 2003
Posts: 192
finally I find java it is in "/usr/java/j2sdk1.4.2_06", I also added this into my .bash_profile; but when I type java; I get command not found.

Thank you very much
Garandi
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Can you run a couple of commands for me and copy and paste the output here?

The commands are:

echo $PATH

and

cd /usr/java/j2sdk1.4.2_06
ls
cd bin
ls

Thanks

Layne
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
Did you restart your terminal after saving your profile file?
Changes won't take immediate effect.

I've also found that it may not use .bashrc at all if there's a .profile for example. May be shell dependent.
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
You can also execute the .bashrc script without logging in again. Just do this:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Installing JDK on Linux.