LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-25-2005, 07:03 AM   #1
infornography
Member
 
Registered: Oct 2003
Location: Australia
Distribution: Xubuntu 6.10
Posts: 73

Rep: Reputation: 15
Adding Java to root users PATH?


I am running Slackware 10.1 with Dropline GNOME 1.10.1 and I'm trying to install a chess program. The program requires java to be installed, which it is. When I run the installer as a normal user it works fine, but I can only install to my home directory. I want to install system wide, but when I run it as root I get this message:

No Java virtual machine could be found from your PATH
environment variable. You must install a VM prior to
running this program.


Is it possible to add it to my PATH environment variable somehow? I did try google, but every page seemed to give totally different explinations.

Thanks.
 
Old 05-25-2005, 09:17 AM   #2
gerrit_daniels
Member
 
Registered: Oct 2003
Location: Belgium
Distribution: Kubuntu
Posts: 34

Rep: Reputation: 15
The file "/etc/profile" should have a line that starts with "PATH=". Add the path to the java bin directory to this variable. Note that all the paths have to be separated by a colon (':').

example:

PATH=/bin:/usr/bin:/path/to/java/bin


Hope this helps
 
Old 05-26-2005, 05:53 AM   #3
infornography
Member
 
Registered: Oct 2003
Location: Australia
Distribution: Xubuntu 6.10
Posts: 73

Original Poster
Rep: Reputation: 15
It didn't work. The path to the java bin seems to be /usr/lib/java/bin. So I added it, and now the relevent section of /etc/profile lookslike this:

# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/usr/lib/java/bin"

It hasn't helped though, I still get the same error message. Any other suggestions?

Thanks for the help so far.
 
Old 05-26-2005, 07:06 AM   #4
JunctaJuvant
Member
 
Registered: May 2003
Location: Wageningen, the Netherlands
Distribution: OS X & FreeBSD
Posts: 488

Rep: Reputation: Disabled
So now as root user, when you enter $PATH on the command line, you see the path to java? And by the way, on my system the java_vm is located in the jre directory (java runtime environment). So on your system this is maybe /usr/lib/java/jre/bin? Try "slocate java_vm" to find it, or whatever filesearch program you prefer.
 
Old 05-26-2005, 08:31 AM   #5
rickh
Senior Member
 
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250

Rep: Reputation: 62
By the looks of these forums, a lot of people have trouble getting Java to work right. Recently ran across a little different technique that works beautifully on Debian. Haven't tried it on Fedora yet, where I often have to create a plugin type link to JAVA ... Anyway, if you want to, you might try this.

From http://www.crazysquirrel.com/debian/...l-sun-java.php

Quote:
Dealing with Packages that Require JAVA_HOME

Unlike a lot of packages many (most) Java packages need to know where the Java VM is installed and they do this through use of an environment variable called JAVA_HOME. You can set this for each package or you can set this globally in "/etc/profile".

Step 1 - Create a Virtual Java

All versions of Java you install will be placed in /usr/lib with names like j2sdk1.5-sun. Create a symlink to one of these called java using the following command (typed at the root prompt):

ln -s /usr/lib/j2sdk1.5-sun /usr/lib/java

Keep this link up-to-date and pointing at which ever version of Java you want as the default. It would be nice if there was a package to do this. Sigh. Maybe there is - anyone know of one?

Step 2 - Adding the Environment Variable to /etc/profile

Once modified your profile file should have changed from something that looks a little like this
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
<...snip...>
export PATH
umask 022

to this

# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
<...snip...>
export PATH
JAVA_HOME="/usr/lib/java"
export JAVA_HOME
umask 022
 
Old 05-26-2005, 08:49 AM   #6
zord
Member
 
Registered: Feb 2005
Distribution: slack 10
Posts: 50

Rep: Reputation: 15
Quote:
Originally posted by infornography
# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/usr/lib/java/bin"

It hasn't helped though, I still get the same error message. Any other suggestions?
did you login as root directly, or did you use 'su' to become root?
if you su'ed, type "source /etc/profile" in a terminal. it should work afterwards
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
adding java jdk to path snecklifter Linux - Newbie 4 11-01-2004 03:58 PM
adding a dir to PATH for root Villain Linux - Newbie 3 06-20-2004 04:49 PM
Adding to Path for root in Suse stefarg Linux - General 1 04-21-2004 06:58 PM
Adding Java to my path in the .bash_profile file .... jmax24 Linux - General 5 04-20-2004 02:14 PM
Adding Java to my environment path? C8H10N4O2 Linux - Software 6 04-19-2004 02:38 PM


All times are GMT -5. The time now is 05:54 AM.

Main Menu
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration