Linux - NewbieThis 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
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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 (':').
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.
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.