LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 05: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, 05:52 PM   #2
tk31337
Member
 
Registered: Oct 2003
Location: Tucson, AZ
Distribution: Linux Mint
Posts: 194

Rep: Reputation: 32
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



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 01:31 AM
bash: rpm: command not found && sudo: alien: command not found Java_Code Ubuntu 7 07-27-2006 11:57 PM
(Debian) bash: java: command not found pjpeter Linux - Newbie 3 09-25-2004 02:59 PM
bash: java: command not found pjpeter Programming 4 09-24-2004 03:02 PM
java command - "bash: java: command not found" ??? RedHat123 Programming 2 07-16-2002 11:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:11 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
Open Source Consulting | Domain Registration