Nov 2, 2010

Installing JKD in fedora

Java development kit is the Java environment which supports to run and compile Java based programs. JDK is containing everything in  Java Runtime (JRE) as well as java compilers  debuggers. Most of the time fedora will contain openJDK but it's better to install Sun micro system JDK. You can download it from there website;

link :
Note - download the JDK not the JRE.

For Fedora it is a file like jdk-6u22-linux-i586-rpm.bin. You need to convert this bin file to an executable file. To do that you can type;

chmod a+x jdk-6u18-linux-i586-rpm.bin

Now we can simply run this file. But this bin file will extract all the file in the current directory. So if you need to install JDK in "/usr/local/", first you must change your directory to that location which you need to install it.

(To install in this location you may need root permission. If you haven't got it you can install it in your home directory.)

$cd /usr/local
(or $cd ~/)
Then you can execute the bin file,

$ ./jdk-6u18-linux-i586-rpm.bin

This will extract files in to a file like "jdk1.6.0_22".

Note - JDK is a rapidly developing thing, there for you may need to install the latest JDK in order to get the maximum from Java. To do these updates you can use this kind of method.

Now you are in /urs/local/,

$ ln  -s    jdk1.6.0_22    jdk
This will create  a soft link in /usr/local/ called jdk which points to the "jdk1.6.0_22" directory. In this way you only need to update the link when ever you need to update/downgrade the JDK in the system.

Now you need to add the bin file in JDK to the PATH variable. To do that you must edit the .bash_profile (or .bashrc)  which contains the PATH variable.

Update the variable into;

       export JAVA_HOME=/usr/local/jdk
       export PATH

then type;
$source .bash_profile

Now you can try
$java -version
This should give the correct version information. If this thing gives wrong information type;
$whereis java
This will give like
Then type;
$ls -la /usr/bin/java
If it  gives like this;
  lrwxrwxrwx. 1 root root 23 2010-11-01 14:42 /usr/bin/java -> /usr/local/jdk/bin/java
If this is the matter you can unlink the java file  in /usr/bin by;
$unlink /usr/bin/java
($unlink /usr/bin/java*  this will unlink all java, javac, javawp)

Then again check the Java version. Make sure all paths and spelling are correct.

No comments:

Post a Comment

Your comments are always welcome ...