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 01-01-2008, 06:06 PM   #1
vinbase
LQ Newbie
 
Registered: Jan 2008
Posts: 3

Rep: Reputation: 0
-bash: java: command not found


Hello,

I have Java here: /usr/java/bin/java

How can i make it available as a command "java" alone.

Do I have to create a symbolic link ?

Thank You.
 
Old 01-01-2008, 06:52 PM   #2
tk31337
Member
 
Registered: Oct 2003
Location: Tucson, AZ
Distribution: Mandrake 10.0 Official
Posts: 193

Rep: Reputation: 31
You could create a symlink, or alternatively you could add /usr/java/bin to your path. PATH is a bash environment variable that determines where to look for commands. In order to add /usr/java/bin to your search path, just run "export PATH=$PATH:/usr/java/bin". Each location in the PATH variable is separated by a colon, so what you're doing here is literally setting the PATH variable to its current contents ($PATH returns the contents of PATH as a string, i.e run "echo $PATH" to see what I mean) with ":/usr/java/bin" amended to it.

That will only set your PATH for the current session. To make the changes permanents, edit .bash_profile in your home directory. It may already have some kind of PATH variable modification in it (i.e mine has "PATH=$PATH:$HOME/bin" with "export PATH" on another line), in which case you just amend the line in question. Anyhow, it should be pretty self-explanatory by now.
 
  


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
bash: g++ command not found briemac Programming 14 12-31-2006 02:31 AM
bash: rpm: command not found && sudo: alien: command not found Java_Code Ubuntu 7 07-28-2006 12:57 AM
(Debian) bash: java: command not found pjpeter Linux - Newbie 3 09-25-2004 03:59 PM
bash: java: command not found pjpeter Programming 4 09-24-2004 04:02 PM
java command - "bash: java: command not found" ??? RedHat123 Programming 2 07-17-2002 12:09 AM


All times are GMT -5. The time now is 01:03 PM.

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