![]() |
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. |
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? |
I don't know. What program did you use to edit the .profile file? |
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. |
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... |
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. |
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 ^_^ |
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. |
Well, I tried editing this profile thru vi and I edit my path for java ok but how do I save those changes? |
To exit vi and save the changes do: [ESC] : wq! [ENTER] Where [ESC] is the escape key and [ENTER] is the enter key. |
I still don't get it. My profile looks like this: ======================== # /etc/profile -*- Mode: shell-script -*- # (c) MandrakeSoft, Chmouel Boudjnah <chmouel@mandrakesoft.com> loginsh=1 # Users generally won't see annoyng core files [ "$UID" = "0" ] && ulimit -S -c 1000000 > /dev/null 2>&1 if ! echo ${PATH} |grep -q /usr/X11R6/bin ; then PATH="$PATH:/usr/X11R6/bin" fi if [ "$UID" -ge 500 ] && ! echo ${PATH} |grep -q /usr/games ; then export PATH=$PATH:/usr/games fi umask 022 USER=`id -un` LOGNAME=$USER MAIL="/var/spool/mail/$USER" HISTCONTROL=ignoredups HOSTNAME=`/bin/hostname` HISTSIZE=1000 if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then INPUTRC=/etc/inputrc fi # some old programs still use it (eg: "man"), and it is also # required for level1 compliance for LI18NUX2000 NLSPATH=/usr/share/locale/%l/%N export PATH PS1 USER LOGNAME MAIL HOSTNAME INPUTRC NLSPATH export HISTCONTROL HISTSIZE for i in /etc/profile.d/*.sh ; do if [ -x $i ]; then . $i fi done unset i j------------------- Java is installed in: /usr/java/j2re1.4.1_03/bin What do I' do ????? dumb as a bag O' hammers |
RE I have followed the procedure and i still cant run Java. When i do java -version it says java command not found. here is my profile : PATH=/usr/java/j2re-1.4.0_03/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/julien/bin JAVA_HOME=/usr/java/j2re-1.4.0_03 PATH=/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/julien/bin export JAVA_HOME thnx a lot in advance 4 ur help ;) gert |
Here Is The 411 Quote:
Second, Your path statement with your $JAVA_HOME path statement should be written as follows: PATH=$JAVA_HOME/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/julien/bin So your profile should look like this: JAVA_HOME=/usr/java/j2re-1.4.0_03 PATH=$JAVA_HOME/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/julien/bin Next you would need to type: source /etc/profile or . /etc/profile #make sure there is a space between the period (.) and slash (/). or source ~/.bash_profile or . ~/.bash_profile #Make sure there is a space between the period (.) and tilde (~). or simply logout and then back in to your system to initialize your system to use the new changes to your shell environment. The dot/period (.) is the same as the "source" command on most systems that don't recognize the "source" command. HTH altoine |
/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/schley/bin Thats my path for right now, but what command do i use in terminal to change it :S? |
There is no one command. You have to edit /etc/profile as root is in the instructions. Before you do anything, read the orignal post for datails and read the replies for additional hints. Make sure you understand what is going on before you change anything. |
Ok I opened it up with vi. only thing I can see to change is this # Path manipulation if [ `id -u` = 0 ]; then pathmunge /sbin pathmunge /usr/sbin pathmunge /usr/local/sbin fi pathmunge /usr/X11R6/bin after |
please bare with me.....retarded newb ok, im sorry for my lack of understanding on how to do this. i have installed the vm, but limewire installer wont reconize the vm. i am running mandrake 9.1 and my profile looks like this...... /* # /etc/profile -*- Mode: shell-script -*- # (c) MandrakeSoft, Chmouel Boudjnah <chmouel@mandrakesoft.com> loginsh=1 JAVA_HOME=/usr/java/j2re1.4.0_01 PATH=$JAVA_HOME/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/pyriel/bin export JAVA_HOME # Users generally won't see annoyng core files [ "$UID" = "0" ] && ulimit -S -c 1000000 > /dev/null 2>&1 if ! echo ${PATH} |grep -q /usr/X11R6/bin ; then PATH="$PATH:/usr/X11R6/bin" fi if [ "$UID" -ge 500 ] && ! echo ${PATH} |grep -q /usr/games ; then export PATH=$PATH:/usr/games fi umask 022 USER=`id -un` LOGNAME=$USER MAIL="/var/spool/mail/$USER" HISTCONTROL=ignoredups HOSTNAME=`/bin/hostname` HISTSIZE=1000 if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then INPUTRC=/etc/inputrc fi # some old programs still use it (eg: "man"), and it is also # required for level1 compliance for LI18NUX2000 NLSPATH=/usr/share/locale/%l/%N export PATH PS1 USER LOGNAME MAIL HOSTNAME INPUTRC NLSPATH export HISTCONTROL HISTSIZE for i in /etc/profile.d/*.sh ; do if [ -x $i ]; then . $i fi done unset i */ im confused. .. .thank you for your time. |
Re: please bare with me.....retarded newb Quote:
rpm -ql j2re|more It should show your current (and more updated) java VM path as /usr/java/j2re1.4.2_01 or something to that extent. Put the updated path into your /etc/profile or ~/.bash_profile like so (Just an example. Your mileage may vary): <snip> JAVA_HOME=/usr/java/j2re1.4.2_01 PATH=$JAVA_HOME/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/pyriel/bin export JAVA_HOME <snip> HTH altoine |
Java Installation Just want to say Thanks!!! I'm new to Linux and was able to walk thru installing JAVA.... Alll Looks well............ |
xterm and gnome can't find Java I just installed Sun's JRE (v1.5.0_01), and LimeWire 4.6.0. I updated my /etc/profile file. When I open a GNOME Terminal, and try to run LimeWire, it can't find my JRE. Apparently, neither GNOME Terminals nor X Terminals run /etc/profile, so my path doesn't get set appropriately. Yes, I can manually source /etc/profile, and then Java works fine. But I don' t want to have to do this every time. Is there any way to automatically set my path, so that GNOME and X Terminals inherit this updated path? (I want to do this system-wide, not just for one user.) Similarly, I really want to run LimeWire from the Gnome menu. However, when I try this (either via a shortcut, or via the Run Application dialog), nothing happens. I suspect that whatever path Gnome is using isn't set by /etc/profile. Any thoughts on how to change this path? (preferably system-wide) As a last resort, I edited "runLime.sh", and sourced /etc/profile within it. This is far from ideal. Any global fixes (which would enable me to run other Java apps from within Gnome) would be greatly appreciated. |
Must be missing something... Alright, I've tried everything here and still can't get any of the java commands to work. I did install the program but, I think the problem is in my path. So, to recap on all the above posts... If I edit my profile in /etc/profile, this is a systemwide change? No matter what user I login as that profile should reflect the changes I made to the path? Second, if I make changes to the path in the profile and the are completly wrong, will they still show up when I type, "echo $PATH" ? Reason I'm asking is because no matter how many times I have changed my profile I dont see ANY of the changes when I run echo $PATH. So, that has me a little concerned... I've included some of my profile for laughs, because it's probably completely wrong but, hopefully other people can learn from it... :) If anyone out there could help it would be GREATLY appriciated. "$UID" = "0" ] && ulimit -S -c 1000000 > /dev/null 2>&1 if ! echo ${PATH} |grep -q /usr/X11R6/bin ; then JAVA_HOME=/usr/java/jre1.5.0_01/bin PATH=$JAVA_HOME/bin:$PATH export JAVA_HOME PATH="$PATH:/usr/X11R6/bin:/usr/java/jre1.5.0_01/bin" Flingus |
hi, the "java" executable is in the "bin" directory of the jre installation. So you only need $JAVA_HOME/bin in your path, and you need that before the rest of the PATH variable. So, simply add PATH=/usr/java/jre1.5.0_01/bin:$PATH before the if statement. |
Thanks Zab.. Looks like Java is happy now but, I'm running into some problems with the rpm file now. I'm hoping this isn't because of the some of the changes I made to my profile.. flingus2001]$ rpm -i LimeWireLinux.rpm error: cannot open lock file ///var/lib/rpm/RPMLOCK in exclusive mode error: cannot open Packages database in /var/lib/rpm Am I doing something wrong here? :confused: |
are you root? |
Ok, it's working now!!!!!!!!!!!!!!!!!!! WOO HOO! Looks like it was already installed. I do have one weird question though.. I made those changes to etc/profile so, I'm guessing that no matter who I log on as in my system should have access to Java. Why then, is the following happening when I try to run Limewire as root? (I did get it to work when I logged in as another user though) Thanks so much for your help. I really think I need to read more on how Linux works at this point. I don't understand the formatting in profile and how it works exactly. Seems odd to me that I would have to add Java in my path but, I didn't have to add Limewire in my path.. Anyway, the following happends as root... This is getting really strange.. It's saying Java isn't in my path again and it's not showing up when I type, "echo $PATH". It worked last time but, now it's not taking the change. It's still in my profile too... Here's my profile.. # /etc/profile -*- Mode: shell-script -*- # (c) MandrakeSoft, Chmouel Boudjnah <chmouel@mandrakesoft.com> loginsh=1 # Users generally won't see annoyng core files [ "$UID" = "0" ] && ulimit -S -c 1000000 > /dev/null 2>&1 PATH=/usr/java/jre1.5.0_01/bin:$PATH if ! echo ${PATH} |grep -q /usr/X11R6/bin ; then PATH="$PATH:/usr/X11R6/bin:/usr/java/jre1.5.0_01/bin" fi if [ "$UID" -ge 500 ] && ! echo ${PATH} |grep -q /usr/games ; then export PATH=$PATH:/usr/games fi umask 022 USER=`id -un` LOGNAME=$USER MAIL="/var/spool/mail/$USER" HISTCONTROL=ignoredups HOSTNAME=`/bin/hostname` HISTSIZE=1000 Here's the results of my echo $path ... echo $PATH /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin And here's what happends when I try to run LimeWire... ./runLime.sh ************************************************** **************** Error: Unable to find java. Please make sure that java is in your PATH. Visit http://www.java.com/en/download/manual.jsp for more information. (LimeWire is tested against and works best with with Sun's JRE, Java 1.4+) I was going to reinstall Mandrake just to try to start off with a clean profile but, I can't even figure out how to do that. I've reinstalled twice and it keeps the files instead of overwriting them. :S What in the world am I doing wrong here? I had no problem at all installing java and LimeWire when I used an earlier version of Mandrake... I am really stumped here.... Flingus :mad::confused: :confused: |
Seems like a mandrake-specific oddity. If the java is listed in /etc/profile it should be part of the path, and you should have access to it. I suggest forwarding this question to a mandrake support forum, they may have a clue what's happening. |
You added it in a section of the profile that's intended to do other stuff. Make it so at the very end of the profile (after the environment variables are set), the path has java added to it. |
dumbo mode on system fedora Core 3 my profile *************************** # /etc/profile # System wide environment and startup programs, for login setup # Functions and aliases go in /etc/bashrc pathmunge () { if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then if [ "$2" = "after" ] ; then PATH=$PATH:$1 else PATH=$1:$PATH fi fi } # Path manipulation if [ `id -u` = 0 ]; then pathmunge /sbin pathmunge /usr/sbin pathmunge /usr/local/sbin fi pathmunge /usr/X11R6/bin after # No core files by default ulimit -S -c 0 > /dev/null 2>&1 USER="`id -un`" LOGNAME=$USER MAIL="/var/spool/mail/$USER" HOSTNAME=`/bin/hostname` HISTSIZE=1000 if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then INPUTRC=/etc/inputrc fi export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC for i in /etc/profile.d/*.sh ; do if [ -r "$i" ]; then . $i fi done unset i unset pathmunge ************************** my problem I AM A DUMBO where do i insert my path statement in this load of (to me) gibberish Hangs head in shame John |
John, with the latest rpm you should not need to set up your path to get LimeWire running. 0. become root 1. Get the latest java from http://www.java.com 2. Get the latest limewire rpm from http://www.limewire.com/LimeWireSoftLinux and install it 3. delete the file /usr/lib/LimeWire/runLime.sh and download this one on top of it: http://www.limewire.org/zlatin/runLime.sh 4. chmod 755 runLime.sh then type "limewire" in the terminal and it should run, or at least print some helpful debug information. |
Cheers Worked a treat John |
limewire pro 4.4 I get an error trying to install, but java is installed and working. Is there something else that could cause this? art@flatulus:~$ sudo sh Lime*.bin Preparing to install... Extracting the installation resources from the installer archive... Configuring the installer for this system's environment... No Java virtual machine could be found from your PATH environment variable. You must install a VM prior to running this program. art@flatulus:~$ java -version java version "1.5.0_02" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09) Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode, sharing) art@flatulus:~$ $echo $PATH bash: /usr/local/bin:/usr/local/sbin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/games:/usr/java/jre1.5.0_02:/usr/java/jre1.5.0_02/bin: art@flatulus:~$ |
Here's my guess. When you use sudo, you're passing root's path to the LimeWire installer. Root's path may be different than your user's path. Just because Java is in your user's path doesn't mean it's in root's path. So, try becoming root (with su), checking your path, manually adding the appropriate Java directories if they're missing, and then running the install script. to manually add the directories: PATH = "$PATH:/usr/java/jre1.5.0_02:/usr/java/jre1.5.0_02/bin" export PATH |
You were partially right. Actually root had the proper PATH as did my normal user. I found that I could install as either one, if I did not use sudo. Its a habit picked up with ubuntu, which uses sudo for most every task that requires root priveleges. It is such a great distro that I can overlook a couple of small inconveniences.. Thanks, Art |
If you don't mind us asking, where did you find the LimeWireLinux.bin file? We offer only an .rpm and a .zip on the official website. Versions prior to 4.8.0 have two serious security vulnerabilities, and you are strongly encouraged to upgrade. |
I've gotten my limewire installed up to the java point... I am very stupid at this whole command line thing, I have NO CLUE how to do the whole change my profile stuff. I need instructions as if I had an IQ of 2 please?? It's wanting the path basically and the path I have it is wrong I guess... |
All times are GMT -7. The time now is 08:11 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.
Copyright © 2020 Gnutella Forums.
All Rights Reserved.