Gnutella Forums

Gnutella Forums (https://www.gnutellaforums.com/)
-   General Linux Support (https://www.gnutellaforums.com/general-linux-support/)
-   -   Installing Java (https://www.gnutellaforums.com/general-linux-support/18536-installing-java.html)

b4k4^ni January 13th, 2003 02:04 PM

Installing Java
 
Installing Java on Linux seems to be a bit of a problem for newbies. Here are a few pointers that hopefully will make the installation a sucess.

Before you do anything, read this whole post and make sure you understand it.

First of all make sure you have a recent version of Linux as recomended by Sun.

Read the installation guide and don't skip steps even if they seem useless.

http://java.sun.com/j2se/1.4.1/jre/install-linux.html

Download the latest version of Java from Sun. You have two choices rpm and bin either one works as long as you follow the exact directions in the installation guide. Here is the java download page:

http://java.sun.com/j2se/1.4.1/download.html

There are a couple of gotchas here. The bin installation is not too clear on the root access. For that reason alone newbies should use the rpm installation.

When you do the rpm installation you first get a file with extension rpm.bin. This is a self extracting file that displays a license ageement and it prompts you to agree (type yes to the prompt) or not (type no). Before you self extract this file you must give it execute permission (chmod) as indicated in the first command of step 2 of the the installation guide. If you you fail to do so, you will not be able to execute the script. Do not attempt any shortcuts here or you may run into problems.

Yes, the current directory ( ./ ) in front of a command is important in Linux so you do need it in the second command of step 2. Unlike WIndows, the current directory in Linux is not in the PATH so executables will not be found if ./ is not specified.

After this step a file with extension rpm is created (if you ageed to the license).

Step 3 indicates to loggin as root. You do this with the "su" command.

Step 5 is done with the command "exit "


I just can't say it enough: Follow the exact instructions in the guide.

After you have succesfully installed Java, you need to make it accesible by modiying the PATH variable to include the java directory in the path. There a several way to do this. I prefer to make it a system wide change so I modify /etc/profile to have a line like this

PATH=<javadirectory>:$PATH

where <javadirectory> is where java executable got installed. The directory will be different according to the version you installed. To find out do this command:

find /usr/ -name "*j2*"

The find command will help you determine the directory that containts the Java installation. What you need is the subdirectory that contains the java executable. This subdirectory is "bin".

Example:

You found out that Java is in

/usr/java/j2re-1.4.0_02

The java executable is in directory

/usr/java/j2re-1.4.0_02/bin

Thus you should change your profile to have this line:

PATH=/usr/java/j2re-1.4.0_02/bin:$PATH

Some Java applications look for a variable called JAVA_HOME. You might as well set this variable in the profile and combine it with the PATH change.

Here is a way to setting up both the PATH and JAVA_HOME in our example where we assumed Java in /usr/java/j2re-1.4.0_02:

Add these lines to the profile:

JAVA_HOME=/usr/java/j2re-1.4.0_02
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME


IMPORTANT
Before you mess around editing /etc/profile make a copy of it. This way you could restore from the copy if necessary.

To make a backup copy do

cp /etc/profile /etc/profile.save


Windows users note that the different paths in the $PATH variable are separated by a colon ( : ) unlike Windows. Also environment variable in Linux are referenced with a $ sign.

Finally make sure you do your PATH and JAVA_HOME before the corresponding "export" commands in /etc/profile

Once you do this change you must login as a user to see if the change and do

echo $PATH
echo $JAVA_HOME

to verify that you have the right PATH and JAVA_HOME.

If you do you will be able to do

which java

and get the directory that has java. If you get an error review your settings and try it again.

Finally this command will tell you for sure if java is installed:

java -version

This should display the version of your java if not then review the steps and fix the problem.


Good luck.

CelestiaLegends April 8th, 2003 12:29 PM

Big Problem
 
I followed the instructions...

When linux starts up and loads X-server, I type in my login and KDE trys to start, but it gets an error and logs back out. (for ALL users, even root). I try to log in on terminal, when I get in I can only run the cd command, all other commands I know (find, ls, cat, joe, vi, su, etc) aren't recognised.

I think that screwed something up, because it's the only thing I changed...I can run all commands in rescue mode, but when I try to edit the profile file, it looks like it's unedited from before (no java path)...whats going on here?

trap_jaw April 8th, 2003 12:38 PM

I don't know. What program did you use to edit the .profile file?

b4k4^ni April 8th, 2003 02:25 PM

Sounds like you might have wiped the contents of the PATH variable. That's why you don't see the commands.

Login as root from a text console (ALT+F2) and do this command:

echo $PATH

You should have at least these directories in the path:

/bin:/usr/bin:/usr/X11R6/bin

You need to edit /etc/profile and fix the assignment to the PATH variable. Make sure you use colon ( : ) as a separator. It is a common mistake for windows users to use simicolon instead.

You can still invoke the commands by specifying the full path.

Hopefully you know how to use the vi editor. If you do then just do

/bin/vi /etc/profile

fix the profile.

Optimally your PATH should contain other directories including the direcotry for Java binaries.

Before you edit any files it is a good practice to make a copy of the file just in case you need to restore it.

CelestiaLegends April 8th, 2003 04:19 PM

Tahnk you!
 
Thank god and thank you! I thought I'd have to reinstall linux again!

Everything works again like before...however java VM still is not reconized...

b4k4^ni April 9th, 2003 02:17 PM

If you need help you need to provide more information.

What exactly do you mean with "java VM not recognized" ?

Which directory did you install java in?

find out with

find / -name "*j2*"

What is the PATH set to?

find out with

echo $PATH

PS: It's good to hear you are up and running again.

CelestiaLegends April 9th, 2003 11:07 PM

when I try to run runLimeWire it still says I need to have java VM installed...

my java dir. is /usr/java/j2re1.4.1_02

my PATH variable is

/usr/java/j2re1.4.1_02:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/opt/kde2/bin:.:/usr/lib/java/bin:/opt/gnome/bin

PS: thanks ^_^

b4k4^ni April 10th, 2003 06:12 AM

CelestialLegends, you just mihgt have helped unlock one of the mysteries of tha java VM installation.

Here is the scoop:

Your Java installation directory is

/usr/java/j2re1.4.1_02


However the java executable is in a subdirectory called "bin" in otherwords

/usr/java/j2re1.4.1_02/bin

so your PATH should be

/usr/java/j2re1.4.1_02/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/opt/kde2/bin:.:/usr/lib/java/bin:/opt/gnome/bin

Do the change then logout and login again for the profile to take effect. Check your PATH and do

which java

Should give you

/usr/java/j2re1.4.1_02/bin/java

Find out the version with:

java -version

You should be OK.

Super new May 11th, 2003 05:55 AM

Well, I tried editing this profile thru vi and I edit my path for java ok but how do I save those changes?

b4k4^ni May 12th, 2003 06:31 AM

To exit vi and save the changes do:

[ESC]
:
wq!
[ENTER]


Where [ESC] is the escape key and [ENTER] is the enter key.


All times are GMT -7. The time now is 06:23 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.

Copyright © 2020 Gnutella Forums.
All Rights Reserved.