How to install java jdk in RHEL?

26,623

Solution 1

Try to run it using sh itself, i.e

sh jdk-6u24-linux-i586-rpm.bin

Solution 2

Please make sure you are doing correct.

To install the Linux RPM (self-extracting) file Follow these instructions:

  1. Become the root user by running the su command and entering the super-user password. At the terminal: Type:

    su
    

    Enter the root password.

  2. Change to the directory in which you want to install. Type:

    cd <directory>
    

    For example, to install the software in the /usr/java/ directory, Type:

    cd /usr/java
    

    Note about root access: To install Java in a system-wide location such as/usr/local, you must login as the root user to gain the necessary permissions. If you do not have root access, install Java in your home directory or a subdirectory for which you have write permissions.

  3. Change the permission of the file you downloaded to be executable. Type:

    chmod a+x jre-6u<version>-linux-i586-rpm.bin
    
  4. Start the installation process. Type:

    ./jre-6u<version>-linux-i586-rpm.bin
    

    The license agreement is displayed. Review the agreement. Press the spacebar to display the next page. At the end, enter yes to proceed with the installation.

  5. The installation file creates and runs the file jre-6-linux-i586.rpm in the current directory.

    RPM unpacking completes

  6. Verify that the jre1.6.0_ sub-directory is listed under the current directory. Type:

    ls
    

    Verify the installation filename

Also refer: http://www.java.com/en/download/help/linux_install.xml#rpm

Share:
26,623
O_O
Author by

O_O

This is my face when I am coding: O_O

Updated on July 05, 2022

Comments

  • O_O
    O_O almost 2 years

    I am following example commands from other sites but it isn't helping!

    What am I doing wrong?

    chmod +x jdk-6u24-linux-i586-rpm.bin
    ./jdk-6u24-linux-i586-rpm.bin
    

    Results give me:

    bash: ./jdk-6u24-linux-i586-rpm.bin: /bin/sh: bad interpreter: Permission denied
    

    Ok.. after doing

    sh jdk-6u24-linux-i586-rpm.bin
    

    as suggested below, I get this:

    enter image description here

    Did the install fail? Is the file corrupted??? Thanks!!

    • uthark
      uthark about 13 years
      Did you try it to run as normal user or as root?
    • O_O
      O_O about 13 years
      I first was root, but the file was in my /media folder so I went into there... was it because the file was not in the root directory?
    • uthark
      uthark about 13 years
      Hmm. maybe your user doesn't have read permission to file, but has exec permission? Do ls -l jdk-6u24-linux-i586-rpm.bin and if file cannot be read by others, then do chmod o+r jdk-6u24-linux-i586-rpm.bin. Anyway, I think that JDK should be installed by root in the systemwide directory.
    • O_O
      O_O about 13 years
      Ah.. ok I think I fixed it by putting the jdk bin file in root instead of leaving it in the /media folder. Is it suggested to install all programs in the root folder?
    • uthark
      uthark about 13 years
      No, your rpm file can be anywhere.
    • uthark
      uthark about 13 years
      It seems that unpacked file ./install.sfx.20555 is not executable. Does your partition mounted with "exec" option? Also, do you have 32 or 64 bit system?
    • O_O
      O_O about 13 years
      I am not sure about the "exec" option and how I can check.. I have a 32 bit system.
    • uthark
      uthark about 13 years
      ok, show output of command "mount | grep noexec". Also, you can download plain binary from Oracle site and try it.
    • O_O
      O_O about 13 years
      Output of command "mount | grep noexec" is /dev/sdb1 on /media/1C type vfat (rw,noexec,nosuid,nodev,shortname=winnt,uid=0)
    • O_O
      O_O about 13 years
      uthark, I think the java jdk install is fine.. everything went ok after I moved the install bin file to the root directory. Not sure what happened when it was in the /media folder though...
    • uthark
      uthark about 13 years
      Heh. As you can see, you /media/1C is mounted as noexec. So, any files that are placed on that drive cannot be executed, that is why installation failed until you moved it to the /root directory, which, I assume is mounted with exec option.
    • O_O
      O_O about 13 years
      oooohh... cool beans. Thanks for all your help uthark! :)