LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-05-2007, 11:07 PM   #1
tecksk8er001
LQ Newbie
 
Registered: Feb 2007
Distribution: Fedora Core 5
Posts: 10

Rep: Reputation: 0
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?
 
Old 02-06-2007, 05:58 AM   #2
Lenard
Senior Member
 
Registered: Dec 2005
Location: Indiana
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790

Rep: Reputation: 58
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.
 
Old 02-06-2007, 09:28 PM   #3
tecksk8er001
LQ Newbie
 
Registered: Feb 2007
Distribution: Fedora Core 5
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks Lenard but I want to install the Java SDK which includes the Java RE.
Any ideas?
 
Old 02-07-2007, 05:47 AM   #4
Lenard
Senior Member
 
Registered: Dec 2005
Location: Indiana
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790

Rep: Reputation: 58
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.
 
Old 02-07-2007, 11:00 PM   #5
tecksk8er001
LQ Newbie
 
Registered: Feb 2007
Distribution: Fedora Core 5
Posts: 10

Original Poster
Rep: Reputation: 0
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
 
Old 02-08-2007, 07:54 AM   #6
Lenard
Senior Member
 
Registered: Dec 2005
Location: Indiana
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790

Rep: Reputation: 58
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.
 
Old 02-08-2007, 09:14 PM   #7
tecksk8er001
LQ Newbie
 
Registered: Feb 2007
Distribution: Fedora Core 5
Posts: 10

Original Poster
Rep: Reputation: 0
Thank you so much Lenard.
Now I can start learning Java.
 
Old 02-09-2007, 06:16 AM   #8
Lenard
Senior Member
 
Registered: Dec 2005
Location: Indiana
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790

Rep: Reputation: 58
Your welcome, glad to help.

It was a good idea to add the directions for the SDK install, glad you asked.
 
Old 02-19-2007, 04:20 PM   #9
star*dreamer
LQ Newbie
 
Registered: Feb 2007
Posts: 1

Rep: Reputation: 0
Thumbs up

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.
 
Old 02-19-2007, 06:13 PM   #10
Lenard
Senior Member
 
Registered: Dec 2005
Location: Indiana
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790

Rep: Reputation: 58
Your welcome, glad to hear it was a help in your efforts. Enjoy!!!
 
Old 03-03-2007, 01:59 PM   #11
isra_mv
Member
 
Registered: Apr 2006
Location: Mexico
Posts: 55

Rep: Reputation: 15
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.
 
Old 03-04-2007, 08:24 AM   #12
Lenard
Senior Member
 
Registered: Dec 2005
Location: Indiana
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790

Rep: Reputation: 58
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.
 
Old 05-21-2007, 11:42 AM   #13
dreamlusion
LQ Newbie
 
Registered: May 2007
Posts: 1

Rep: Reputation: 0
Thumbs up I was helped to.

Lenard thank you, I was helped too

Regards,
George.
 
Old 05-21-2007, 06:38 PM   #14
Lenard
Senior Member
 
Registered: Dec 2005
Location: Indiana
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790

Rep: Reputation: 58
To dreamlusion (and others):

You are welcome, glad to have helped.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
J2ME and JAVA SDK configuration problem on Fedora Core 4 vikram_cvk Linux - Software 0 03-23-2006 05:12 AM
Java SDK and Fedora Core 3 caps_phisto Fedora 5 01-12-2005 02:02 PM
Java SDK in Fedora Core 3 (64 bit) uphu Linux - Software 7 12-08-2004 05:47 PM
Installing Java SDK 1.4.2_05 hevykevy7 Linux - Software 4 09-11-2004 04:39 AM
Installing JAVA SDK 1.3 on RedHat7.3 jenze76 Linux - Software 2 08-15-2004 10:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration