Makes the build Java package agnostic

This commit alters the build process to detect the type of Java
package installed on the build system and adjusts the SPEC file
accordingly.