LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Linux Answers > Applications / GUI / Multimedia
User Name
Password

Notices


By kevcart3 at 2004-09-23 05:37
Hi, and thanks for reading this HOWTO! Although these instructions are made for Fedora Core 2, they will more than likely work on any machine that has RPM support such as Mandrake, Suse, etc.

Requirements:
--------------------
1. You need to have at least a small knowledge on working the terminal and some basic commands that you will use.

First off, you will need to download the RPM from Sun's web site (http://www.java.com)
The file will be called something similar to j2re1_4_2_05-linux-i586-rpm.bin. After downloading the package for the VM, put it in a place where you can find it from the terminal such as your home directory.

Next, open a terminal session and do an SU to become root and enter the root password.
Code:
$ su
$ password: ******
# cd /home/kevin
Navigate to the directory using cd where you saved the RPM (EX: cd /home/kevin/)

Use the following command to run the self-installer.
Code:
# ./j2re1_4_2_05-linux-i586-rpm.bin (or whatever the package name is)
Then, read the agreement, pressing space to scroll down until you are at the end of the document. Type "yes" to agree to the license agreement. This will create an actual RPM in the same directory that you downloaded the RPM Binary.

After agreeing to the license, you will verify you know the name of the file using the dir command. The RPM should be called j2re1_4_2_05-linux-i586.rpm or similar according to the version you have downloaded.

Now, you are going to want to install the RPM for the VM, still as root, type the following command:

Code:
# rpm -ivh j2re1_4_2_05-linux-i586.rpm (or whatever the name of the file is)
If this is done correctly you should see something saying that it was completed with 100%.

CRUCIAL PART OF THE PROCESS:
---------------------------------------------------

I have had a lot of problems with making the Java VM work under FC2, because when you install the RPM, it actually doesn't make it work, it just installs it. So here is the steps to make the VM the default java vm for the OS:

First, make sure to have a terminal open and logged in using the SU command by entering the root password.

Then verify the directory that you have java installed under by doing this:

Code:
$ cd /usr/java
$ ls
You should see that there is a directory called j2re1.4.2 or something similar. If not, try this installing the RPM again, maybe something didn't go right.

Then you will have to remove all the default java associations by doing the following:

Code:
# cd /usr/bin
# rm java javac jar
If you get an error in removing any of the files java, javac, OR jar, it's okay, it's just to make sure you remove them. You will have to confirm to remove these files by typing a y at the prompt.

Next, you will have to create a link between the newly installed VM and the defaults for FC2 java vm by using the following command:

Code:
# cd /usr/bin
# ln -s /usr/java/j2re1.4.1_01/bin/java java
Be sure to replace the /usr/java/j2re1.4.1_01/bin java with whatever version you are running, but it should always point to the /bin/java directory under that folder.

Now, you should have a clear link between the two files so that you can install programs that require a Java VM installed.

If you are wanting to install LimeWire, enable java in Firefox or Mozilla, then read further, otherwise, Congratulations, you now have Sun's Java VM installed and configured.

LimeWire Install Instructions:
---------------------------------------

Since you have already installed the Java VM, all you should need to do now is navigate to the directory where you downloaded the Binary and type the following command:

Code:
$ sh ./LimeWireLinux.bin
After that, the program should install normally.


Firefox Instructions:
--------------------------

Navigate to the directory where Firefox is installed using the cd command as root in a terminal. Then you will see another directory called plugins, go to this directory and type this command while in the ./plugins directory of your firefox installation:

Code:
# ln -s /usr/java/j2re1.4.1_01/plugin/i386/ns610-gcc32/libjavaplugin_oji.so
This will create a link from the java vm to Firefox plugins, to test the browser, simply go to a web site that requires java installed, such as http://www.java.com

Mozilla Instructions:
--------------------------

To install the java vm for mozilla, simply use the Firefox instructions, with the exception of the directory where mozilla is installed. Then go to the ./plugins directory as above and create a link using the command above.

This concludes my HOWTO on installing Sun's Java VM, if you have any questions, feel free to email me at kevcart3@gmail.com.

by salparadise on Wed, 2004-10-20 02:23
er
seems like a long winded way of achieving things
i just went to dag.wiers site and downloaded the j2re rpm and the mozilla-j2re rpm and that was that

by FunkyRes on Mon, 2004-11-29 02:30
do NOT remove the java javac and jar files in /usr/bin

That is poor advice - and the symlinks you create will be destroyed in an rpm update to the packages that own them.

Instead, set your JAVA_HOME environmental variable and set $JAVA_HOME/bin at the beginning of your path.

Let's say for you example you installed blackdown j2re in /opt/blackdown/j2re-1.4.2-01

You would create a file called j2re.sh in /etc/profile.d/ containing the following:

Code:
#!/bin/sh
export JAVA_HOME=/opt/blackdown/j2re-1.4.2-01
if [ `echo $PATH |grep -c "$JAVA_HOME"` -eq 0 ]; then
        export PATH=$JAVA_HOME/bin:$PATH
fi
and make it executable ( chmod +x /etc/profile.d/j2re.sh )

Watch what this does -

Code:
[buildmaster@devel ~]$ which java
/opt/blackdown/j2re-1.4.2-01/bin/java
[buildmaster@devel ~]$ echo $PATH
/usr/kerberos/bin:/opt/blackdown/j2re-1.4.2-01/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/buildmaster/bin
[buildmaster@devel ~]$
I did not have to remove any binaries or make any symlinks, when I log in - /etc/profile.d/j2re.sh gets executed, putting /opt/blackdown/j2re-1.4.2-01/bin at the front of my path resultint in binaries contained within being at the front of my path.

In the case of the sun rpm mentioned in the article, it puts the java install in /usr/java/j2re1.4.1_01/ so you would change the JAVA_HOME in the above script to point to there.

by mjbrej on Tue, 2004-12-07 23:51
Good summary of the basics--nice of you to take the time to write this up for others! One additional point--many java programs will allow you to specify the JVM you want to use via the -vm switch after the program executable. To use this (for example, if you have multiple versions of the JVM on your machine), you would just specify "-vm <path to correct version of your JVM> after the executable command. Hope this helps some of your readers who need some advanced information.

by kevcart3 on Sun, 2004-12-19 06:41
Thanks for the advice guys, i just wrote this early one moring after spending a whole night trying to get it to work on my FC2 machine. I thought it would be good to pass my knowledge on from what I found.

by spooon on Tue, 2005-08-09 04:35
Fedora Core 4 release notes now recommends that you DO NOT use Sun's JDK packages (see description of bugs). You should build the package from the JPackage Project instead.

The full instructions for building it are here; and the following is a summary of the steps:
1. become root
2. install the "java-1.5.0-sun-1.5.0.05-1jpp.nosrc.rpm" package, with something like this:
Code:
rpm -i http://mirrors.dotsrc.org/jpackage/1.6/generic/non-free/SRPMS/java-1.5.0-sun-1.5.0.05-1jpp.nosrc.rpm
3. it extracts stuff into /usr/src/redhat
4. download the "jdk-1_5_0_05-linux-i586.bin" file from Sun website and put it in /usr/src/redhat/SOURCES
5. run
Code:
rpmbuild -ba /usr/src/redhat/SPECS/foo.spec
6. in the /usr/src/redhat/RPMS/i586 directory, it makes the following RPMs that you can install:

* java-1.5.0-sun-1.5.0.05-1jpp.i586.rpm - JRE (required)
* java-1.5.0-sun-devel-1.5.0.05-1jpp.i586.rpm - JDK
* java-1.5.0-sun-src-1.5.0.05-1jpp.i586.rpm - sources
* java-1.5.0-sun-demo-1.5.0.05-1jpp.i586.rpm - demonstration files
* java-1.5.0-sun-plugin-1.5.0.05-1jpp.i586.rpm - browser plugin
* java-1.5.0-sun-fonts-1.5.0.05-1jpp.i586.rpm - fonts
* java-1.5.0-sun-alsa-1.5.0.05-1jpp.i586.rpm - ALSA support
* java-1.5.0-sun-jdbc-1.5.0.05-1jpp.i586.rpm - JDBC/ODBC bridge driver

7. If you install browser plugin and want to make it work, do something like this:
Code:
cd /usr/lib/mozilla/plugins
ln -s /etc/alternatives/jre/plugin/i386/ns7/libjavaplugin_oji.so .

by kevcart3 on Tue, 2005-08-09 19:24
Thank you Spooon, these are some good updated instructions for FC4, seeing as how I wrote this for FC2, this is probably pretty outdated.

by ArenaJAG on Thu, 2005-08-18 11:06
Is there another way I should be following to install on a RedhatES4 system?

If I run the rpmbuild command I get an error:
Bad exit status from /var/tmp/rpm-tmp.72538 (%prep)

Nothing built.

Thanks,

JAG

EDIT:

Nevermind screwup. Gotit.

by chriselswede on Fri, 2005-10-28 13:54
Hi Spoon,

the instructions you give in LinuxQuestions.org seem to be exactly what I need, thank you! However the link http://mirrors.dotsrc.org/jpackage/1.6/generic/non-free/SRPMS/java-1.5.0-sun-1.5.0.04-1jpp.nosrc.rpm
seems to be old. Do you know where I could find this rpm today?

Thanks again
/Chris

by spooon on Fri, 2005-10-28 14:34
http://mirrors.dotsrc.org/jpackage/1...1jpp.nosrc.rpm

By the way, there is an article on FedoraNews that describes this method of installation (although a slightly different way of doing it).


  



All times are GMT -5. The time now is 03:18 PM.

Main Menu
Advertisement
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