Installing Sun Java JDK for Users

Issues related to software problems
CentOS_beginner
Posts: 9
Joined: 2007/01/19 22:11:30

Re: Installing Sun Java JDK for Users

Post by CentOS_beginner » 2007/01/20 20:53:31

I didn't notice your fast reply (for some reason I dont get messages about new posts).

here's the answers to your questions:

- I installed this jre-6-linux-i586-rpm.bin
downloaded it from java.sun.com (under j2se section / download)

- here's what that command line gives:
root@ser1 [~]# rpm -qa --qf="%{n}-%{v}-%{r}.%{arch}\n" '*gcj*' | sort
libgcj-3.4.6-3.i386
libgcj4-4.1.0-18.EL4.i386
libgcj4-devel-4.1.0-18.EL4.i386
libgcj-devel-3.4.6-3.i386
root@ser1 [~]#


- the /usr/local/jdk/bin/java directory came out when I did all the steps described by you and ran "which java" command

Anyways I suspect that the path of the currently installed/displayed java version was incorrectly filled in this command line:

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

As for "and so on" I would only point out that in my first message above I copy&pasted everything I wrote and got in the SSH

Lenard
Posts: 2283
Joined: 2005/11/29 02:35:25
Location: Indiana

Re: Installing Sun Java JDK for Users

Post by Lenard » 2007/01/21 15:32:46

OK,

First; It is a good idea to (in the future) to report the pathing information to where something is found. My java.conf file is found in the /etc/java/ directory location and reads the same as yours. Sometimes this location is different depending on which version of jre is installed (there are three different jre versions BTW, Sun's, IBM's and Blackdown's).

Second: it looks like you have the the default jave lib packages installed, which is just fine. But since you do not seem to have the java-1.4.2-gcj-compat-1.4.2.0-27jpp.noarch.rpm installed skip the step;

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

And just use this step instead;
/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jre1.6.0/bin/java 1

Then continue on from the step; /usr/sbin/alternatives --config java ; you should see only the /usr/java/jre1.6.0/bin/java listed.

I did configure java (again) on my laptop system to provide the example below, it makes no changes on the laptop since it was already setup. I did add some line spacing to make reading easier;

[root@Aspire5000 ~]# rm /var/lib/alternatives/java
rm: remove regular file `/var/lib/alternatives/java'? y

[root@Aspire5000 ~]# /usr/sbin/alternatives --install /usr/bin/java java /usr/java/jre1.6.0/bin/java 1

[root@Aspire5000 ~]# /usr/sbin/alternatives --config java

There is 1 program that provides 'java'.

Selection Command
-----------------------------------------------
*+ 1 /usr/java/jre1.6.0/bin/java

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

[root@Aspire5000 ~]# /usr/sbin/alternatives --display java
java - status is manual.
link currently points to /usr/java/jre1.6.0/bin/java
/usr/java/jre1.6.0/bin/java - priority 1
Current `best' version is /usr/java/jre1.6.0/bin/java.

[root@Aspire5000 ~]# which java
/usr/bin/java

[root@Aspire5000 ~]# java -version
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)

You can skip creating the /etc/profile.d/java.sh file and source step like I did, no reason to anyhow you have done them already.

CentOS_beginner
Posts: 9
Joined: 2007/01/19 22:11:30

Re: Installing Sun Java JDK for Users

Post by CentOS_beginner » 2007/01/23 11:06:19

Hi, just noticed your reply. Yes I do have the deafult java installed (but obviously want the newest one 1.6.0 to be working with my Java appication).

As suggested by you, I skipped that step. Here's what I did and what I got (I will line space also):

root@ser1 [~]# rm /var/lib/alternatives/java
rm: remove regular file `/var/lib/alternatives/java'? y

root@ser1 [~]# /usr/sbin/alternatives --install /usr/bin/java java /usr/java/jre1.6.0/bin/java 1

root@ser1 [~]# /usr/sbin/alternatives --config java

There are 1 programs which provide 'java'.

Selection Command
-----------------------------------------------
*+ 1 /usr/java/jre1.6.0/bin/java

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


root@ser1 [~]# /usr/sbin/alternatives --display java
java - status is manual.
link currently points to /usr/java/jre1.6.0/bin/java
/usr/java/jre1.6.0/bin/java - priority 1
Current `best' version is /usr/java/jre1.6.0/bin/java.

root@ser1 [~]# which java
/usr/local/jdk/bin/java

root@ser1 [~]# java -version
java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)
root@ser1 [~]#



Note how the last two command replies are different from what you get. I wish I hadn't any Java installed by default on that server. Did I mention its a remote one, maybe this has something to do with it not working as for others.. Thanks for your patience and for the will to make this happen. if you will, let's nail it to the end.

Lenard
Posts: 2283
Joined: 2005/11/29 02:35:25
Location: Indiana

Re: Installing Sun Java JDK for Users

Post by Lenard » 2007/01/23 14:46:50

OK, once again how did this get to be (the directory);

root@ser1 [~]# which java
/usr/local/jdk/bin/java


Did you or somebody else install this version of the jdk from a non-rpm package??? If you do not know then ask around a bit.

The path if installed from the rpm package (after expanding and installing) is /usr/java does this directory exist and does it have the files /usr/java/jdk1.6.0/bin/java and usr/java/jre1.6.0/bin/java, if yes what happens when you do;

/usr/java/jdk1.6.0/bin/java -version

/usr/java/jre1.6.0/bin/java -version

They should report something like(remember I have the 64-bit version of the jdk rpm package installed);

]$ /usr/java/jdk1.6.0/bin/java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0-b105, mixed mode)

[lenard@Aspire5000 ~]$ /usr/java/jre1.6.0/bin/java -version
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)

If your results are similar then you have the rpm package installed correctly. As a suggestion you can try removing the entire usr/local/jdk/ directory tree then (once more) run through the configuration steps from my post #12 in this thread. Maybe this remote server is managed by someone else???? Are you renting/leasing this remote server??? Maybe speaking with the host manager may be helpful and provide some insight and/or assistance, if this is a virtual system then this might be the issue.

CentOS_beginner
Posts: 9
Joined: 2007/01/19 22:11:30

Re: Installing Sun Java JDK for Users

Post by CentOS_beginner » 2007/01/23 16:39:08

Hello and thanks for your patience (sorry but I didn't find a a PM button on this forum in order to keep this private).

There is a positive progress. here's the answers to your questions and what I did

"Did you or somebody else install this version of the jdk from a non-rpm package??? If you do not know then ask around a bit."

The server is rented. its a dedicated one. non-managed, meaning managed by myself.
And I didn't install this 1.4.2_05 JDK/JRE. It's either been installed by default when server prepared for me OR it got installed when I recompiled Apache with Java enabled (maybe it was executed/installed back then by itself).
As for the JRE 1.6.0, afirmative, it was installed by myself from an RPM package downloaded from java.sun.com

"The path if installed from the rpm package (after expanding and installing) is /usr/java does this directory exist and does it have the files /usr/java/jdk1.6.0/bin/java and usr/java/jre1.6.0/bin/java, "

There is no 'jdk' in the '/usr/java/' folder.
And there is indeed /usr/java/jre1.6.0/bin/java proving that the JRE1.6.0. package installed correctly

"if yes what happens when you do; /usr/java/jdk1.6.0/bin/java -version
/usr/java/jre1.6.0/bin/java -version"

Yes it gives this:
root@ser1 [~]# /usr/java/jre1.6.0/bin/java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Server VM (build 1.6.0-b105, mixed mode) <<---- here your reult gave also "sharing"


"As a suggestion you can try removing the entire usr/local/jdk/ directory tree then (once more) run through the configuration steps from my post #12 in this thread."

In the /usr/local/ directory there is :
1. a "j2sdk1.4.2_05"
2. and a 'jdk' shortcut folder that is leading to the above mentioned jdk 1.4.2_05 version


I deleted those two folder above. Then ran through the steps from your post #12.
It was fine till this command:

/usr/sbin/alternatives --config java

It gave:

-bash: usr/sbin/alternatives: No such file or directory

To the following command it gives correct path:

root@ser1 [~]# which java
/usr/bin/java


And to "java -version" command it gives the correct reply:
root@ser1 [~]# java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Server VM (build 1.6.0-b105, mixed mode)


Looks like the deletion of the early mentioned folder got it solved. But is it 100% solved.. now that it doesn't find "usr/sbin/alternatives"

Thanks again

CentOS_beginner
Posts: 9
Joined: 2007/01/19 22:11:30

Re: Installing Sun Java JDK for Users

Post by CentOS_beginner » 2007/01/23 16:43:54

Finally everything shows correctly. It appears to be the uninstalling / deletion of the early install JDK (earlier version) that did the job.

thanks lenard once again

Lenard
Posts: 2283
Joined: 2005/11/29 02:35:25
Location: Indiana

Re: Installing Sun Java JDK for Users

Post by Lenard » 2007/01/23 18:17:06

Your welcome, glad you got it worked out.

CentOS_beginner
Posts: 9
Joined: 2007/01/19 22:11:30

Re: Installing Sun Java JDK for Users

Post by CentOS_beginner » 2007/01/23 23:47:53

A quick one if you will because am searching quite a bit on the net and decided to address to someone who already helped me out.

I have now installed JMF for this application to run corectly. have followed these steps:

http://www.luniks.net/luniksnet/html/java/jtvd/doc/jmf.html

But am having problems with step no. 6:

"To complete the installation, you should set the environment variables JMFHOME, CLASSPATH and LD_LIBRARY_PATH according to the JMF installation path you have chosen. If you for example have installed JMF to /usr/lib/JMF-2.1.1e, then you could add the following lines to your .profile:

export JMFHOME=/usr/lib/JMF-2.1.1e
export CLASSPATH=.:$CLASSPATH:$JMFHOME/lib/jmf.jar
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JMFHOME/lib"

To what .profile is this referring to exactly, for I didnt find any in my /usr/lib/JMF-2.1.1e

CentOS_beginner
Posts: 9
Joined: 2007/01/19 22:11:30

Re: Installing Sun Java JDK for Users

Post by CentOS_beginner » 2007/01/24 00:26:56

is it the /etc/.profile and should I add these lines to the end of it

Lenard
Posts: 2283
Joined: 2005/11/29 02:35:25
Location: Indiana

Re: Installing Sun Java JDK for Users

Post by Lenard » 2007/01/24 01:27:28

The lines are added to you hidden .bash_profile in your home directory by any text editor.

Example;

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:.

export JMFHOME=/usr/lib/JMF-2.1.1e
export CLASSPATH=.:$CLASSPATH:$JMFHOME/lib/jmf.jar
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JMFHOME/lib"

export PATH
unset USERNAME

Post Reply