LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Help installing Java sdk/jdk 6 on Fedora core 6 (https://www.linuxquestions.org/questions/linux-software-2/help-installing-java-sdk-jdk-6-on-fedora-core-6-a-525948/)

tecksk8er001 02-05-2007 11:07 PM

Help installing Java sdk/jdk 6 on Fedora core 6
 
As you have guised I am a newb to Linux, whenever I stray from the GUI Desktop I feel very afraid.

Anyway, For the past month I have bee trying to install the Java SDK 6 and RTE from the jdk-6-linux-i586 package.
My os is Linux Fedora Core 5.
After numerous attempts, installing and the uninstalling, I am fed up with all of the tutorials and howtos that are outdated and do not work with the jdk 6.

Can anyone give me step by step help on installing the jdk on fc5?

If not, could someone point me in the right direction?

Lenard 02-06-2007 05:58 AM

Reconfiguring the default Java configuration for Red Hat / Fedora

This is done as root or equivalent.

First remove /var/lib/alternatives/java file by typing;

rm /var/lib/alternatives/java

When asked press the 'y' key,

Now to create the new (corrected) alternatives file for java type
the following commands as root (modify for jdk as needed);

/usr/sbin/alternatives --install /usr/bin/java java /usr/lib/jvm/jre-1.4.2-gcj/bin/java 1

/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jre1.6.0/bin/java 2

/usr/sbin/alternatives --config java

You should now see for example:

There are 2 programs which provide 'java'.

Selection Command
-----------------------------------------------
1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+ 2 /usr/java/jre1.6.0/bin/java

Enter to keep the current selection[+], or type selection number:

Type: <choose 1 or 2>

In the example above java is already configured correctly [*+ 2] to
use Sun's Java, no changes are needed, just press the Enter key here.
If you have been following the instructions then you should have
the same results (version numbers may be sightly different).

Now type; /usr/sbin/alternatives --display java

You should see for example;

java - status is manual.
link currently points to /usr/java/j2re1.5.0_09/bin/java
/usr/lib/jvm/jre-1.4.2-gcj/bin/java - priority 1
/usr/java/jre1.6.0/bin/java - priority 2
Current `best' version is /usr/java/jre1.6.0/bin/java.

Next you might want to create (or edit) /etc/profile.d/java.sh
file, example below;

export JAVA_HOME="/usr/java/jre1.6.0/bin/bin"
export JAVA_PATH="$JAVA_HOME"
export PATH="$PATH:$JAVA_HOME"

When done creating or editing the file type;

source /etc/profile.d/java.sh

Now any user root or other wise should be able to use the command;

which java

and the results should read something like;

/usr/bin/java

Also any user root or other wize should be able to use the command;

java -version

and the results should read something like;

java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

That's it, all done.

tecksk8er001 02-06-2007 09:28 PM

Thanks Lenard but I want to install the Java SDK which includes the Java RE.
Any ideas?

Lenard 02-07-2007 05:47 AM

Modify the commands a bit, it is up to you to make the adjustments needed just change the paths for Sun's Java to reflect the SDK pathing.

tecksk8er001 02-07-2007 11:00 PM

Quote:

Originally Posted by Lenard
Modify the commands a bit, it is up to you to make the adjustments needed just change the paths for Sun's Java to reflect the SDK pathing.

I would but as I said I am very new to Linux.
I tried to do that before but just kept getting errors.
Hate to ask this of you but could you maybe run through the tutorial you gave and change the commands to suit my needs?
I would be very greatful:D

Lenard 02-08-2007 07:54 AM

OK, here you go...........

Reconfiguring the default Java configuration for Red Hat / Fedora

This is done as root or equivalent.

First remove /var/lib/alternatives/java file by typing;

rm /var/lib/alternatives/java

When asked press the 'y' key,

Now to create the new (corrected) alternatives file for java type
the following commands as root;

/usr/sbin/alternatives --install /usr/bin/java java /usr/lib/jvm/jre-1.4.2-gcj/bin/java 1

For jre:

/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jre1.6.0/bin/java 2

For jdk:

/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.6.0/jre/bin/java 2

/usr/sbin/alternatives --config java

You should now see for example:

There are 2 programs which provide 'java'.

Selection Command
-----------------------------------------------
1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+ 2 /usr/java/jre1.6.0/bin/java

Enter to keep the current selection[+], or type selection number:

Type: <choose 1 or 2>

In the example above java is already configured correctly [*+ 2] to
use Sun's Java, no changes are needed, just press the Enter key here.
If you have been following the instructions then you should have
the same results (version numbers may be sightly different).

Now type; /usr/sbin/alternatives --display java

You should see for example;

java - status is manual.
link currently points to /usr/java/jre1.6.0/bin/java
/usr/lib/jvm/jre-1.4.2-gcj/bin/java - priority 1
/usr/java/jre1.6.0/bin/java - priority 2
Current `best' version is /usr/java/jre1.6.0/bin/java.

Next you might want to create (or edit) /etc/profile.d/java.sh
file, examples below:

For jre;

export JAVA_HOME="/usr/java/jre1.6.0/bin"
export JAVA_PATH="$JAVA_HOME"
export PATH="$PATH:$JAVA_HOME"

For jdk;

export JAVA_HOME="/usr/java/jdk1.6.0/jre/bin"
export JAVA_PATH="$JAVA_HOME"
export PATH="$PATH:$JAVA_HOME"


When done creating or editing the file type;

source /etc/profile.d/java.sh

Now any user root or other wise should be able to use the command;

which java

and the results should read something like;

/usr/bin/java

Also any user root or other wize should be able to use the command;

java -version

and the results should read something like;

java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

That's it, all done.

See not that hard to change.

tecksk8er001 02-08-2007 09:14 PM

Thank you so much Lenard.
Now I can start learning Java.

Lenard 02-09-2007 06:16 AM

Your welcome, glad to help.

It was a good idea to add the directions for the SDK install, glad you asked.

star*dreamer 02-19-2007 04:20 PM

Thank you so much Lenard, Eclipse used to run so slow on my computer preventing me from developing anything on fedora using Eclipse, but now that i have followed your steps and switched to SUN's java it runs as it should. Excellent guide.

Lenard 02-19-2007 06:13 PM

Your welcome, glad to hear it was a help in your efforts. Enjoy!!!

isra_mv 03-03-2007 01:59 PM

Thank you, Lenard, at last a good and quick java 6 instalation guide.
Just one thing, in the profile.d/java.sh, I used jdk1.6.0/bin for JAVA_HOME, because jdk1.6.0/jre/bin doesn't have the compiler, and the one I used does have it.

Lenard 03-04-2007 08:24 AM

Which exactly what you should do, good for you. This is a guide and adjustments are sometimes needed for things to be right. Glad you found this helpful.

dreamlusion 05-21-2007 11:42 AM

I was helped to.
 
Lenard thank you, I was helped too :)

Regards,
George.

Lenard 05-21-2007 06:38 PM

To dreamlusion (and others):

You are welcome, glad to have helped.


All times are GMT -5. The time now is 04:05 AM.