Working on unix-based systems (e.g. Linux or Mac) could be a pain when you haven’t installed the system by your own. At work I have in most cases the problem that the servers i am working on are installed individually. Well the SysOps always says „We use puppet, and every Server is installed at the same….“, but often i can not figured out the location where java is installed.
I know that there a a lot of other ways how to find out the location where java is installed, i will show here how to find it out with the RPM tool (assumed java is installed with rpm)
If i figured out another way i will add it here.
One possible way is to the RPM tool.
- Find out if Java is installed as a RPM package
Is Java as installed as a RPM package?23jdk-1.7.0_72-fcs.x86_64java-1.6.0-openjdk-18.104.22.168-22.214.171.124.el6_7.x86_64
- Check which java version is used by the system
234java version "1.7.0_72"Java(TM) SE Runtime Environment (build 1.7.0_72-b14)Java HotSpot(TM) 64-Bit Server VM (build 24.72-b04, mixed mode)
- Get information about the installed and active package
234567891011121314151617181920Name : jdk Relocations: /usr/javaVersion : 1.7.0_72 Vendor: Oracle CorporationRelease : fcs Build Date: Sa 27 Sep 2014 03:57:33 CESTInstall Date: Mo 01 Dez 2014 15:51:12 CET Build Host: sc14160135.us.oracle.comGroup : Development/Tools Source RPM: jdk-1.7.0_72-fcs.src.rpmSize : 206819031 License: http://java.com/licenseSignature : DSA/SHA1, Mo 01 Dez 2014 15:46:20 CET, Key ID eacf30652d13dd17Packager : Java Software <firstname.lastname@example.org>URL : URL_REFSummary : Java Platform Standard Edition Development KitDescription :The Java Platform Standard Edition Development Kit (JDK) includes boththe runtime environment (Java virtual machine, the Java platform classesand supporting files) and development tools (compilers, debuggers,tool libraries and other tools).The JDK is a development environment for building applications, appletsand components that can be deployed with the Java Platform StandardEdition Runtime Environment.
- Get the location path of the installed package files
234567891011# [...]/usr/java/usr/java/jdk1.7.0_72/usr/java/jdk1.7.0_72/COPYRIGHT/usr/java/jdk1.7.0_72/LICENSE/usr/java/jdk1.7.0_72/README.html/usr/java/jdk1.7.0_72/THIRDPARTYLICENSEREADME-JAVAFX.txt/usr/java/jdk1.7.0_72/THIRDPARTYLICENSEREADME.txt/usr/java/jdk1.7.0_72/bin# [...]
Now is easy to identify the location where java is installed, here its in the folder jdk1.7.0_72 and the path is: /usr/java/
Thanks to Michi