Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Installing JDK on Linux.

 
Garandi Garandi
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Garandi Garandi
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Garandi Garandi
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What distro are you running? You may want to try "locate java".

Layne
 
Garandi Garandi
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also execute the .bashrc script without logging in again. Just do this:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic