• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 220
  • Last Modified:

"which java" is not wokring

In my java aplication, hosted on jboss, there is a this situation:
# jre is installed
# but I dont get any thing if a execute "which java"
# executing "java -version" also does not work.
So commands like java -cp [XYZ] give error like
java: command not found
Any help?

0
pvinodp
Asked:
pvinodp
  • 6
  • 5
2 Solutions
 
whyitelluCommented:
First Check that Java is Properly installed or not?

if installed then try for java -v

and don't forget to set Class path for java (u can easily googling )

still problem then try to install Latest JDK .

and after that not solved then post related output/data.
0
 
PapertripCommented:
This is just a path problem, need to find the actual install directory for java, and either add that to your path or create symlinks to someplace like /usr/bin.

First off start looking in like /usr/java/jdk.version/bin/

If you don't see it there, try using 'locate java|grep bin'.  If that doesn't work then use 'find / -name java -type f'

Once you find the path, you can add that to the PATH envvar for your shell.  Here are instructions on how to add setup JAVA_HOME and PATH.

The other choice is creating a symlink to a directory that is in your path. For example, 'ln -s /usr/java/jdk6/bin/java /usr/bin/java'
0
 
pvinodpAuthor Commented:
In a production server it is not necessary to install jdk. I think it is for development purpose.

It has jre installed. And another system in the cluster is also in the same state : jre installed and nothing in .bashrc except sourcing  /etc/bashrc.

But the command which java , java -version , and java -cp works in that system.

Any clue now?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
pvinodpAuthor Commented:
I've requested that this question be deleted for the following reason:

We are still unable to solve the ssue. I am goging to delete this question. Kindly revert in case u have any other steps...
0
 
PapertripCommented:
I just used '/usr/java/jdk.version/bin/' as an example.

Did you run the locate and/or find commands?

Bottom line -- if java is installed, but not showing up when you issue 'which java', then it is not in your path.
0
 
pvinodpAuthor Commented:
ok. but how do u set it?
I dont want to disturb .bashrc on the affected system [sysA].
 I insist this because another system [sysB] in the cluster has the same content in .bashrc and it does return the path /usr/bin/java on executing "which java".

but the sysA does show installation of jre.
0
 
PapertripCommented:
Still waiting to hear if you got any results from the find or locate commands I originally posted.

Add this to this list:
rpm -qa|grep -i java

Open in new window

0
 
pvinodpAuthor Commented:
The locate java and find java command resulted in showing the installed jre 1.4 .
I cant access the system right now... It is at the customer lab .. I shall try "rpm -qa****" and let you know..
Any other way u think of mentioning? Because i get only limited time to check on the system.

0
 
PapertripCommented:
Which Linux distro and version are you running?  How did you install the jre?
0
 
PapertripCommented:
Objecting as "Far from done".
0
 
pvinodpAuthor Commented:
it is rhel5 .. I am not sure, but they would have installed using rpm -ivh jre1.4$$$.rpm
0
 
pvinodpAuthor Commented:
Thanks all for your contribution
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now