Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there a way to specify the location where all the installed files would go when installing Java JDK on red hat linux 6? Currently when I follow the steps mentioned in Installation Guide, it defaults to /usr/java/ and I would like to have all the files installed at a separate location.

share|improve this question
    
I'm really curious as to why. It's not as though they interfere with anything else there. –  Ignacio Vazquez-Abrams Jun 28 '13 at 17:36
    
We have a central location(which is not /usr/java/) which stores all versions of Java. Hence the question –  darkie15 Jun 28 '13 at 17:37
    
"3. Change directory to the location where you would like the files to be installed." -- Are you in /usr/java when you run this binary? –  Aaron Copley Jun 28 '13 at 17:56
    
@AaronCopley: No –  darkie15 Jun 28 '13 at 18:41

1 Answer 1

You can execute the self-extracting *.bin in a temporary directory and move the resulting files to whatever destination you want to.

I really dislike the way the installer creates random symlinks breaking the alternatives system.

Personally, I don't see any real value in having the JDK in non-standard locations, though.

To deal with the updates of the Oracle JDK, my solution is to create an RPM using fpm. It installs to the default location and has a post-install script added to run an update-alternatives hook so the latest version is immediately available. Applications using the old java version still need to be restarted, of course.

You can adapt my solution to fit your needs by changing the --prefix parameter.


fpm -s dir -t rpm \
    --prefix /usr/lib/jvm \
    --force \
    --name java-1.7.0-oraclejdk \
    --version 1.7.0.25 \
    --iteration 1 \
    --epoch 20130621 \
    --license 'Oracle Binary Code License Agreement for the Java SE Platform Products and JavaFX' \
    --vendor 'Oracle' \
    --category 'java' \
    --architecture x86_64 \
    --maintainer '' \
    --exclude src.zip \
    --description 'The Oracle JDK runtime environment.' \
    --url http://www.oracle.com/ \
    --after-install java-alternatives.sh \
    --template-scripts \
    --template-value priority=1725 \
    --rpm-os el6 \
   jdk1.7.0_25
alternatives --install /usr/bin/java       java           /usr/java/jdk<%= version >/jre/bin/java <%= priority > \
         --slave   /usr/bin/appletviewer   appletviewer   /usr/java/jdk<%= version >/bin/appletviewer \
         --slave   /usr/bin/apt            apt            /usr/java/jdk<%= version >/bin/apt \
         --slave   /usr/bin/ControlPanel   ControlPanel   /usr/java/jdk<%= version >/bin/ControlPanel \
         --slave   /usr/bin/extcheck       extcheck       /usr/java/jdk<%= version >/bin/extcheck \
         --slave   /usr/bin/idlj           idlj           /usr/java/jdk<%= version >/bin/idlj \
         --slave   /usr/bin/jar            jar            /usr/java/jdk<%= version >/bin/jar \
         --slave   /usr/bin/jarsigner      jarsigner      /usr/java/jdk<%= version >/bin/jarsigner \
         --slave   /usr/bin/javac          javac          /usr/java/jdk<%= version >/bin/javac \
         --slave   /usr/bin/javadoc        javadoc        /usr/java/jdk<%= version >/bin/javadoc \
         --slave   /usr/bin/javafxpackager javafxpackager /usr/java/jdk<%= version >/bin/javafxpackager \
         --slave   /usr/bin/javah          javah          /usr/java/jdk<%= version >/bin/javah \
         --slave   /usr/bin/javap          javap          /usr/java/jdk<%= version >/bin/javap \
         --slave   /usr/bin/java_vm        java_vm        /usr/java/jdk<%= version >/jre/bin/java_vm \
         --slave   /usr/bin/javaws         javaws         /usr/java/jdk<%= version >/bin/javaws \
         --slave   /usr/bin/jcmd           jcmd           /usr/java/jdk<%= version >/bin/jcmd \
         --slave   /usr/bin/jconsole       jconsole       /usr/java/jdk<%= version >/bin/jconsole \
         --slave   /usr/bin/jcontrol       jcontrol       /usr/java/jdk<%= version >/bin/jcontrol \
         --slave   /usr/bin/jdb            jdb            /usr/java/jdk<%= version >/bin/jdb \
         --slave   /usr/bin/jhat           jhat           /usr/java/jdk<%= version >/bin/jhat \
         --slave   /usr/bin/jinfo          jinfo          /usr/java/jdk<%= version >/bin/jinfo \
         --slave   /usr/bin/jmap           jmap           /usr/java/jdk<%= version >/bin/jmap \
         --slave   /usr/bin/jps            jps            /usr/java/jdk<%= version >/bin/jps \
         --slave   /usr/bin/jrunscript     jrunscript     /usr/java/jdk<%= version >/bin/jrunscript \
         --slave   /usr/bin/jsadebugd      jsadebugd      /usr/java/jdk<%= version >/bin/jsadebugd \
         --slave   /usr/bin/jstack         jstack         /usr/java/jdk<%= version >/bin/jstack \
         --slave   /usr/bin/jstat          jstat          /usr/java/jdk<%= version >/bin/jstat \
         --slave   /usr/bin/jstatd         jstatd         /usr/java/jdk<%= version >/bin/jstatd \
         --slave   /usr/bin/jvisualvm      jvisualvm      /usr/java/jdk<%= version >/bin/jvisualvm \
         --slave   /usr/bin/keytool        keytool        /usr/java/jdk<%= version >/bin/keytool \
         --slave   /usr/bin/native2ascii   native2ascii   /usr/java/jdk<%= version >/bin/native2ascii \
         --slave   /usr/bin/orbd           orbd           /usr/java/jdk<%= version >/bin/orbd \
         --slave   /usr/bin/pack200        pack200        /usr/java/jdk<%= version >/bin/pack200 \
         --slave   /usr/bin/policytool     policytool     /usr/java/jdk<%= version >/bin/policytool \
         --slave   /usr/bin/rmic           rmic           /usr/java/jdk<%= version >/bin/rmic \
         --slave   /usr/bin/rmid           rmid           /usr/java/jdk<%= version >/bin/rmid \
         --slave   /usr/bin/rmiregistry    rmiregistry    /usr/java/jdk<%= version >/bin/rmiregistry \
         --slave   /usr/bin/schemagen      schemagen      /usr/java/jdk<%= version >/bin/schemagen \
         --slave   /usr/bin/serialver      serialver      /usr/java/jdk<%= version >/bin/serialver \
         --slave   /usr/bin/servertool     servertool     /usr/java/jdk<%= version >/bin/servertool \
         --slave   /usr/bin/tnameserv      tnameserv      /usr/java/jdk<%= version >/bin/tnameserv \
         --slave   /usr/bin/unpack200      unpack200      /usr/java/jdk<%= version >/bin/unpack200 \
         --slave   /usr/bin/wsgen          wsgen          /usr/java/jdk<%= version >/bin/wsgen \
         --slave   /usr/bin/wsimport       wsimport       /usr/java/jdk<%= version >/bin/wsimport \
         --slave   /usr/bin/xjc            xjc            /usr/java/jdk<%= version >/bin/xjc
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.