LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Mandriva (https://www.linuxquestions.org/questions/mandriva-30/)
-   -   alternatives command not working (https://www.linuxquestions.org/questions/mandriva-30/alternatives-command-not-working-384654/)

timb5163 11-19-2005 12:23 PM

alternatives command not working
 
I am installing Java and following these instructions. When I use the alternatives command I get this response.

[timb@Home timb]$ su -
[root@Home root]# alternatives --install /usr/bin/java java /usr/java/jre1.5.0_05/bin/ java 3
-bash: alternatives: command not found

Any suggestions. Thanks.


Timb

MensaWater 11-19-2005 01:12 PM

Quote:

-bash: alternatives: command not found
This is saying your shell (bash) couldn't find a location for a command named "alternatives".

Possible reasons for this:

1) The path where the command exists is not in your PATH variable.

2) The command is not on your system.

3) The command is on your system but doesn't have execute bit set so isn't recongized as an executable.

To find where the command is:

find / -name alternatives

The above should print out the full directory for this command (e.g. /usr/local/bin/alternatives).
You would then type "echo $PATH" and see if that path (e.g. /usr/local/bin) appears in the output separated by colons from other paths in the variable. If not you can append it to the PATH variable by typing "PATH=$PATH:/usr/local/bin" (/usr/local/bin is ONLY an example - you'd substitute whatever path alternatives was found in here).

If find does NOT show alternative then you need to install whatever package includes the command - go to rpmfind.net to locate this.

If the command IS found and IS in PATH then its likely number 3. You need to make it executable with the chmod command.

timb5163 11-19-2005 10:30 PM

Thanks for the suggestions. I tried all of them and here is the response.


[root@Home timb]# find / -name alternatives
/etc/alternatives
/var/lib/rpm/alternatives
find: /proc/4645/task: No such file or directory
[root@Home timb]# PATH=$PATH:/etc/alternatives
[root@Home timb]# echo $PATH
/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/etc /alternatives
[root@Home timb]# alternatives --install /usr/bin/java java /usr/java/jre1.5.0_0 5/bin/ java 3
bash: alternatives: command not found

I went to /etc/alternatives and I don't find an alternatives command that I can change to executeable.

Timb

timb5163 11-19-2005 10:32 PM

Also,

I tried installing chkconfig which is what someone told me has the alternatives command in it. When I install that rpm it tells me that it is installed already. I will try to uninstall and reinstall.

springshades 11-20-2005 12:01 AM

Are you trying to install the JRE package of Java or the JDK? You want the JRE package if you just want to run java programs or enable java content in web pages and that sort of thing. You only need the JDK if you are actually planning on writing java software.

The reason I ask is I looked at the instructions page on the java site for installing JRE and they never use a command called alternatives that I can see. Are these the instructions you're following?

http://java.com/en/download/help/500...selfextracting

timb5163 11-20-2005 09:21 AM

I am installing the JRE and those instructions work but you have to link java to the programs that you need it for. I wanted java to be available for any program that needs it. I found this post and it covered everything I wanted to do.

http://mandrivausers.org/index.php?showtopic=27828

I have seen alternatives being used in other instructions so I know it has to exist.

Thanks

Timb

tkedwards 11-20-2005 05:57 PM

The command is 'update-alternatives', see
Code:

man update-alternatives
Also you don't need /etc/alternatives from your $PATH


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