LinuxQuestions.org
Review your favorite Linux distribution.
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-19-2010, 03:10 PM   #1
sandy_76
LQ Newbie
 
Registered: Sep 2009
Posts: 10

Rep: Reputation: 0
Java version in Linux


Hi guys

Java is installed in linux machine and when I enter the command java -version it shows java is not found.
At the same time when i run from the folder where its installed with ./java -version it works.

first of all why its not working from any other place? also why do I need to give ./ from the folder?
Please help me
 
Old 01-19-2010, 03:21 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
This deals with basic Linux search paths.

The page here explains it:
http://www.linux-tutorial.info/modul...ent&pageid=329
 
Old 01-19-2010, 04:42 PM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,492

Rep: Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639Reputation: 3639
Redhat EL 5 : if you install a random java package
to /usr/java/ :

cd /usr/bin/
.. example jdk :
# ln -s /usr/java/jdk<version>/jre/bin/java

And if you want a package created for EL 5 :
The Scientific Linux repo .. e.g. i586 :
http://ftp.scientificlinux.org/linux...7-fcs.i586.rpm
> > jdk-1.6.0_17-fcs.i586.rpm
x86_64 : http://ftp.scientificlinux.org/linux...fcs.x86_64.rpm
> > jdk-1.6.0_17-fcs.x86_64.rpm

These packages will set up the links at install ..
also to /etc/alternatives/ ,
so you can change between versions with the command :
# /usr/sbin/update-alternatives --config java
.....
 
Old 01-19-2010, 08:58 PM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,358
Blog Entries: 4

Rep: Reputation: 3822Reputation: 3822Reputation: 3822Reputation: 3822Reputation: 3822Reputation: 3822Reputation: 3822Reputation: 3822Reputation: 3822Reputation: 3822Reputation: 3822
When you encounter a "command not found" message, it does not necessarily mean that the command does not exist... only that it was not found.

You indeed have already verified that the command does exist, when you used cd to go to the directory where you know it to be installed, then used the ./commandname syntax to explicitly refer to it by its location (i.e. "right here").

The shell uses a variable called $PATH to determine "where to look" for a command that you enter. You can see the value of this variable by entering: echo $PATH. The entries in this list are separated by ":" characters.

Offhand, it seems to me that you should work this problem by assuming that, somehow, "the java command didn't get installed in the place where it 'ought to' be." This is not a command-file that should find itself "just any old where," and it I'd suggest that you first try to figure out why it is where it is.
 
  


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
Trying to install latest Java version in Crunchbang linux froginlinux Linux - Newbie 2 06-16-2009 04:15 PM
Does PHP-Java-Bridge Version 5.2 work on Linux RHEL 4 - Update 6 ellappavs Red Hat 0 02-09-2009 10:22 AM
Iceweasel Java plugin using the Apt version of Sun Java? Zaskar Debian 3 10-03-2008 07:35 AM
how to see the tomcat and java version in a linux server Karthi_India Linux - Newbie 1 08-21-2007 02:03 AM
What version of Java comes with Linux? CodeWarrior Linux - Software 5 05-13-2003 03:17 AM

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

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