SlackwareThis Forum is for the discussion of Slackware Linux.
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.
You could verify if you have installed jre from /slackware/l or jdk from /extra. If you have one of them installed (I don't know if you can have both installed at the same time), check the value of the PATH environment variable with echo $PATH. Then, try to make sure one of the directories in it is the one that holds the java executable. You can find which one is that with a command like grep '/bin/java$' /var/log/packages/j*
Thanks for that.
Looks like its in usr/lib/java/bin/java
First I get
$ echo $PATH
/usr/local/bin:/bin:/usr/bin
then
$ grep '/bin/java$' /var/log/packages/j*
/var/log/packages/jre-6u11-i586-1:usr/lib/java/bin/java
so it looks like I have it in
usr/lib/java/bin/java
next prob - why shouldnt it work?
/usr/lib/java/bin is not in the contents of PATH. Maybe it has to do with the way you start your terminal. Try to start it as a "login terminal" if possible. For example, check the following: run xterm -ls and a new terminal will pop up. In that new terminal, try to see if java -version works. If it works, that's the problem.
Actually, I think it's not worth messing up with bashrc or bash_profile or anything as long as you can make sure your terminal starts a login shell. Most terminal programs (Konsole, for example) have a way to do that. You just need to find how. If you can't find the option, tell us the terminal you're using and someone will probably be able to tell you where the option is.
When you open a bash shell as a login shell, the /etc/profile script is executed. This script then looks for executable scripts in /etc/profile.d.
There are scripts (jre.sh, jre.csh, jdk.sh and jdk.csh) in /etc/profile.d that set the PATH. Check whether these scripts are executable.
If you open a bash interactive shell that is not a login shell, then the ~/.bashrc script is executed. If you want to add the java paths to your $PATH, then add lines to ~/.bashrc.
I dont seem to have a ~/.bashrc I did a 'locate' for a bashrc and a bash.rc
Nothing there! Maybe this is a problem.
There are 31 files altogether in /etc/profile.d
They are all owned by root and executable by owner group and others.(except scim)
I have the 2x Jre entries (jre.sh and jre.csh) but not the *.jdk
I think Im correct that most applications you install with some command line stuff but thereafter one can expect to start the application using a menu item.
I am unsure about whether a bash (interactive) is a login shell or not a login shell. I will have to do some serious reading on that.
Usually you don't need to have a ~/.bashrc file unless you want to change a default shell setting for your user account or some other particular settings. Having the PATH environment variable properly set is not really part of that. Maybe this provides a good starting point:
Part of launching the shell properly, of course. When you log in via a virtual terminal everything is set up properly. /etc/profile is sourced, and in turn this sources the contents of /etc/profile.d and you get the expected environment. It turns out when you launch a terminal emulator in X, the command line environment you get is not the same because the shell is not launched the same way, and it can be solved by launching the terminal emulator or shell properly, without "patching" stuff via ~/.bashrc or ~/.bash_profile.
I use those to add some personal directories to the PATH, or to establish some environment variables for my user account, but not for sourcing system files that are already sourced when you start the shell properly. It will work but, to give you an analogy, it's like hitting a nail with a wrench. I prefer to use a hammer and, when someone asks, that's the advice I like to give.
A fine point. A side note: X virtual terminals represent a class of tools which need this sort of attention. GNU Screen also seems to need to be instructed in this sense. Having a bashrc + bash_profile [eventually one being a symlink to the other or somesuch] is a centralised solution for the above utilities.
Last edited by noctilucent; 06-07-2009 at 05:36 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.