File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Linux / UNIX and the fly likes [CentOS 5.5] How to find location of installed softwares Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "[CentOS 5.5] How to find location of installed softwares" Watch "[CentOS 5.5] How to find location of installed softwares" New topic
Author

[CentOS 5.5] How to find location of installed softwares

Saurabh Pillai
Ranch Hand

Joined: Sep 12, 2008
Posts: 507
I need to find the installation location of Java and Glassfish. I have full access to the server. I can not find it using GUI search option with words like java and glassfish. echo $JAVA_HOME does not echo anything. Web app is up and running on the server. and I know glassfish needs jvm (hence jdk) in order to run web app.

Not to mention, I did not do the installation of those softwares. so I don't know if they have been installed using YUM (or similar utilities), ZIP or Add/Remove program. I am also newbie in Linux.

What is the default location of any installed software?

Thank you for any help.
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

Saurabh Pillai wrote:I need to find the installation location of Java and Glassfish. I have full access to the server. I can not find it using GUI search option with words like java and glassfish. echo $JAVA_HOME does not echo anything. Web app is up and running on the server. and I know glassfish needs jvm (hence jdk) in order to run web app.

Not to mention, I did not do the installation of those softwares. so I don't know if they have been installed using YUM (or similar utilities), ZIP or Add/Remove program. I am also newbie in Linux.

What is the default location of any installed software?

Thank you for any help.


what happens when you type

> which java

and what happens when you type
> printenv
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

searching for java, you can use:

> find -name java


for glassfish

> find -name startserv

which is a file that should be in a glassfish installation.
Saurabh Pillai
Ranch Hand

Joined: Sep 12, 2008
Posts: 507
which java

It returns /usr/bin/java
printenv

It returns a whole lot, what should I look for? PATH?
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

Saurabh Pillai wrote:
which java

It returns /usr/bin/java
printenv

It returns a whole lot, what should I look for? PATH?


well, maybe you should describe what you want to do. You said you wanted to know where java is installed and I think you found that with /usr/bin/java

have you been able to find glassfish? Have you had any luck using find -name?
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

If you do:

ls -al /usr/bin/java

you'll find out that it is a link to another location. If you do the same ls for that, you will eventually find out where the JRE is installed.

To find out in general where things are installed, use the rpm command. Here's a handy guide:
http://www.idevelopment.info/data/Unix/Linux/LINUX_RPMCommands.shtml
I suspect the "rpm -ql xxx" command is what you want. The xxx is the package name, the "rpm -qa" command will list the names of all packages installed. Its a long list, so filter the results using grep or redirect the results to a file and browse with an editor.

JBoss In Action
Saurabh Pillai
Ranch Hand

Joined: Sep 12, 2008
Posts: 507
Tim McGuire wrote:
well, maybe you should describe what you want to do. You said you wanted to know where java is installed and I think you found that with /usr/bin/java

have you been able to find glassfish? Have you had any luck using find -name?


Sorry I forgot to mention, yes I did find glassfish too using given command.

My main task is to upgrade Production server with latest JDK and Glassfish.

1) We have OpenJDK on Production. Which one is better OpenJDK or Oracle JDK?
2) Same for Glassfish, Open source edition or Enterprise edition?

Thank you
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

The "Java" that comes with Linux is still (as far as I know) not suitable for use with J[2]EE servers. So the /usr/bin/java (OpenJDK) is not a good choice.

The recommended way to select the Java to be used for a particular application (such as GlassFish) is to set the environment variable JAVA_HOME to point to the desired JDK/JRE. Note that "JAVA_HOME" is neither an OS nor a installed Java property, just the conventional name for the Java home. Most popular Java apps - such as Ant, Maven and Tomcat will expect JAVA_HOME to point to the JDK or JRE, but that's just the way that their execution scripts were written. There's no master standard for it, just common usage.

When you install on a RedHat-style system such as CentOS or Fedora, JDKs and JREs are installed under the /usr/java directory (assuming you don't override the rpm installer). There are also aliases named "default" and "latest" that allow apps to avoid updating their JAVA_HOMES every time a new Java release is installed.

If you don't use the RPM and instead download and explode the tarball, you can install Java any bloody place you like.


Customer surveys are for companies who didn't pay proper attention to begin with.
gurpeet singh
Ranch Hand

Joined: Apr 04, 2012
Posts: 924
    
    1

Saurabh Pillai wrote:I need to find the installation location of Java and Glassfish. I have full access to the server. I can not find it using GUI search option with words like java and glassfish. echo $JAVA_HOME does not echo anything. Web app is up and running on the server. and I know glassfish needs jvm (hence jdk) in order to run web app.

Not to mention, I did not do the installation of those softwares. so I don't know if they have been installed using YUM (or similar utilities), ZIP or Add/Remove program. I am also newbie in Linux.

What is the default location of any installed software?

Thank you for any help.


you can use rpm command as follows

rpm -qa|grep <keyword with name of your software> after this you can do this

rpm -ql <name returned from grep command> // this command returns list of files associated with that program
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

The "add/remove" program features in CentOS use the Redhat Package Manager (RPM). So does yum.

However, most J2EE stuff isn't installed through RPMs, and of the J2EE stuff that is, a lot of it isn't going to be used in a GlassFish environment. As I said, the "built-in" Java isn't J2EE-certifiable, and the RPMs that RHEL (and clones like CentOS) install aren't going to be referenced by GlassFish. I don't think a GlassFish RPM exists, though I could be wrong.

So to see if a Sun/Oracle JDK is installed, you can do "rpm -qa | grep java" or look for /usr/java. For GlassFish, you'll just have to search the filesystem (/usr/local is a preferred location, but also check /opt or /server).

You should be able to locate JDK installations using the "locate" command and "locate jarsigner". In some cases, the locate database-builder cron task is disabled, though, so try "locate bash" to see if it's working.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

The OpenJDFK should be just fine for Java EE use. I have several Linux systems at work that run with JDK, and they are handling various Java EE apps. I even use them to build Java apps that later run on Windows without any issues. And these are fairly complicated apps.
 
Consider Paul's rocket mass heater.
 
subject: [CentOS 5.5] How to find location of installed softwares