LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   adding commands to /bin (root user) (https://www.linuxquestions.org/questions/linux-software-2/adding-commands-to-bin-root-user-161132/)

xone 03-22-2004 06:20 PM

adding commands to /bin (root user)
 
Hi everyone,
I am trying to add commands such as: javac, java etc. to ' /bin' so that everyone can use them. Simply copying the commands is not adding them I've tried that already. Does anyone know how to do it. I am new to Linux (just installed fedora core yesterday).

Thank you

hw-tph 03-22-2004 06:30 PM

Hi and welcome to LQ!

The best solution is probably adding the bin dir of the Java SDK to your $PATH environment variable. The $PATH is a list of directories that will be searched for executables, and you can set it globally or just for yourself.

In the file /etc/profile you can add a line that goes something like this:
Code:

export PATH=$PATH:/usr/local/j2sdk-1.4.02_03/bin
The line above assumes that the you have the SDK installed to /usr/local/j2sdk-1.4.02_03 - if you have it elsewhere you have to change it to whatever is appropriate for your installation. The $PATH is a colon-separated list, so the line above means "set the $PATH to whatever it was before plus our Java bin directory".

Then simply log out and log in again and you should be able to type javac (or whatever) at the prompt and it will launch and function as expected.

For programs that you install manually you shouldn't use /bin or /usr/bin - drop them in /usr/local/bin since that's what the /usr/local tree is for - locally built software.


Håkan

Pwnz3r 03-22-2004 07:54 PM

You can also find the binary and make a shell script within the /usr/bin directory that looks like this.

cd /usr/local/path-to-binary's-folder
./binaryname

hw-tph 03-23-2004 02:18 AM

Both the java and javac commands are useless without passing parameters to them, and with that shellscript the parameters wouldn't be passed at all.


Håkan

xone 03-23-2004 12:26 PM

Hakan, thank you for yor response. It worked! And Pwnx3r, I did not try your method b/c the other one already worked and it sounds a littlbe bit complicated too, but thank you for suggesting it anyway.

bp


All times are GMT -5. The time now is 06:37 PM.