DebianThis forum is for the discussion of Debian Linux.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Installing Java is one of those things that we do only once in a great while, and, if you're like me, you always need to go looking for instructions on how to do it. The best set of such instructions has always been here, but for some reason there is now a glitch on the page that means the commands are not being printed. I mananged to put the commands back together from several sources, and I think it deserves to be here where I can find it when I need it.
First get rid of any java version you may have already installed. Run the command
$ java -version
If it finds anything, get rid of the old one. Some installations come with a crippled version of java which doesn't necessarily identify itself clearly. It might be named gij-4.0 or something else. Using 'locate java' may help you identify it's real name.
1. Get the Sun .bin file.
It's available here, or someplace nearby. You need the .bin file (not the .rpm) for either ix86 or amd64. Download it and put it in a working directory. Something like /home/yours/java makes sense.
2. Get "java-package".
You need the key application that makes this whole thing work, java-package. It's available in the 'contrib' section of your official Debian repo. Assuming that's on your /etc/apt/sources.list file, ...
# apt-get install java-package
That installation will include fakeroot, deb-helper, etc., if you don't already have them.
3. Create the .deb Package File.
cd to the working directory you created in step 1, and (as a regular user) ...
$ fakeroot make-jpkg jre-1_5_0_06-linux-i586.bin
Of course, your downloaded file name may differ somewhat from mine. Get it right, Tab Completion is your friend.
Sun may force you to bow to their omniscience by making you agree to something important to them during the unpacking process. Humor them. There will probably be some warnings during the two minute (+ or -) process of package building, but as long as it all ends the a message stating that the Debian package was successfully created, those messages are inconsequential.
4. Install the Java .deb Package.
Now you have to be root, so stay in the working directory, su, enter password, and ...
# dpkg -i sun-j2re1.5_1.5.0+update06_i386.deb
Again, if your package name doesn't quite match mine, get it right.
5. Check that it works.
This should be easy, unless it's not. As both root and a regular user run the command $ java -version The response should be something close to:
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode)
Notice how the version numbers match those of my .bin and .deb packages above. If yours don't, you have another version of Java already installed. See paragraph 2.
(Brief Intermission) Most Java packages need to know where the Java VM is installed. They find this out through an environment variable called JAVA_HOME. All versions of Java you install, including the one you just finished, will be placed in /usr/lib with names like j2re1.5-sun. The next two steps create an alias (symlink) to that Java VM, and set up the JAVA_HOME variable at login. Find your java home directory (something like /usr/lib/j2re1.5-sun), and make sure you know it's name.
6. Create a soft link to the java home directory.
This step usually eliminates the need to link from the plugin library of programs like Firefox that need to know where java lives in order to find plugins. Assuming that the java package you have installed is the same as my example, ... as root ... create a soft link like this:
# ln -s /usr/lib/j2re1.5-sun /usr/lib/java
7. Add the Environment Variable to /etc/profile
Using vim (if you're a manly man) or another text editor, open /etc/profile and look at or near the bottom. You should see a couple lines like this:
In Debian I found the easiest way to install Sun Java is to:
Add the following to your sources.list:
deb http://ftp.debian-unofficial.org/debian/ sarge main contrib non-free restricted
deb-src http://ftp.debian-unofficial.org/debian/ sarge main contrib non-free restricted
Then use Synaptic to search for the current Sun jre-binary. Select and apply. Java and the plugin for Mozilla/Firefox automatically install.
Why all the complicated steps when Synaptic or Apt-get take care of all that for you? That is the beauty of running a Debian system. Heck I have had 3 or 4 versions at one time with no problems, even had Blackdown and Sun both installed at one time.
I wasn't trying to say your way was bad. I apologize if I came off as that way.
Its just that using Synaptic/Apt-get properly will save you many steps with a lot of apps, not just Java. Same goes for most broswer plugins like Mplayer, Flash, Realplayer, Adobe. Even wine installs very easily with Synaptic. It's all a matter of having the things you need in your sources.list.
Your way will most likely help quite a few people that run into trouble. It is a lot more detailed than I possible could have done. Keep up the good work.
I know this is very un-Debianlike, but I just extract the Sun JDK into my ~/Programs/jdkxxx folder, then just add the appropriate folder to my path (hmmm ... perhaps they should really be in /usr/local/bin), and create symlinks in ~/.mozilla/plugins (for JRE).
But then, I have many apps installed in ~/Programs. It's like my own little package management system I guess. I just like to do it this way because it isn't touching the system, just my own setup. And I can upgrade and remove apps at will, *knowing* nothing is left behind. I still haven't got to the point of *completely* trusting apt-get uninstalls yet (a hangover from my Window's days).
I also like configuring stuff manually too, eg flash, Adobe, firefox, thunderbird etc. For me, Debian Sarge is just a very reliable, stable base system to install a bare-bones XFCE desktop with only the apps I want. And for me, it works absolutely brilliantly!
Of course this also isn't useful for a multi-user PC, which mine is not.
hello i tried the method on the mini howto
and i get this message :
"make: the `-j' option requires a positive integral argument"
then a list of option of make.
about the other methods; is it possible to have a mini howto as well, or an extensive howto is even better,
thanks in advance.
So far I have solved the proble by using 2 steps in Fedora RedHat:
1) For plugins:
ln -s /usr/java/jdk1.5.0_06/jre/plugin/i386/ns7/libjavaplugin_oji.so ./libjavaplugin_oji.so
2) For Path:
By editing the /etc/profile file in the following way:
# Path manipulation
if [ $EUID = 0 ]; then
#This line is added by me
OK. Update. I was mildly embarrassed at very reasonable suggestions that my method was unnecessarily complicated, then Debian made it even worse by very publically adding Sun Java to their official repos. I am now in the process of setting up a new 32-bit system, so I had the opportunity to do it the easy way.
I feel better now. The easy way blew up in my face, but the old tried and true method outlined above worked again.
My problems, briefly, involved the fact that installing Sun Java from the repos did not delete the gij.4.1 java that came with the Debian desktop installation. Open Office and other programs were also thoroughly integrated with that app. Firefox didn't handle java applets correctly, and when I tried to use 'java -jar filename.jar' to execute a java program, it also didn't work. A large part of those problems seemed to be related to /etc/profile not including the JAVA_HOME variable.
In checking for java installations, I found, what appeared to be, two separate identical directories in /usr/lib/jvm/ ... One named something like sun-java5-1.5.0 and another named sun-java-1.5.0-06. (Those are probably not exactly right, but something close.)
When I went to purge all that stuff including gij, aptitude took OpenOffice as well. No problem ... I got the Sun .bin file, built and installed the .deb, edited /etc/profile, and voila!, everything worked. No need for Mozilla plugins or any of that foolishness.
Now I just have to reinstall OpenOffice, which previous experience tells me will like Sun Java as well as it did gij. In the process, I also found that Sun had an updated version, for whatever that's worth.
Easy is fine, but I'm an old man. Sometimes it's easier to stick with the devil I know.
Actually, I have decided this howto is obsolete since the Debian repo packages are now so well supported. I have never used the blackdown packages, so I can't speak for them. The Testing Repos have Sun Java6 version 6-00-2. I think Sid has 6-01-1, but only for the i386 arch. I would recommend one of those, but since the Debian package stores the files in different directories, when you're finished, you may need to use "# update-alternatives --config java" to actually get it working. I would also remove the line from this howto in your /etc/profile
The changeover from the old way to the new is not as clean as one might hope, but I think it's worth it. As far as I know it doesn't carry any dependencies of it's own, but some programs already installed that depend on java may be affected.