How to Find JRE installed in linux machine..?

Hi all,

Im new to linux... Im in need to write a shell script to check wthr JRE in linux machine... Wtz de best way to find thru BASH?? Plz help me out to solve this issue...

Thanks

By JRE, do you mean a basic java install? That can be checked by running 'which java'. If it is in the path, it will show up. Other ways include running a find on / and looking for the file with your name. That will be slow, though.

Unlike Windows, there is no standard way to find out if java is installed on your machine unless ofcourse /usr/bin/java points to GNU java or the SUN java.

You can, at best, look into the environment variables LD_LIBRARY_PATH and PATH to see whether you have a JAVA related path in those env variables.

Unfortunately a solution like "which java" doesn't always work. For instance, I need to find the JRE location not for the binary "java", but for the library libjvm.so, because I want to launch a JVM from C native code.
The library path is something like this: "<JAVA_HOME>/jre/lib/i386/client/libjvm.so, and because of all symbolic links, if I get a path like /usr/bin/java using "which", it doesn't help me much.