How do I install Java JRE 7?

Discussion in 'Bukkit Help' started by booooo201, Jun 30, 2012.

  1. Offline

    booooo201

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    First off, I'm on a VPS running CentOS 6.

    I already downloaded the RPM, set the alternatives --config java. But when I do: java -verison,
    it says command not found. But when I install OpenJDK, It works fine. I create my own plugins(Even though I'm new here) but they require Java version 1.7.
  2. Offline

    rominos2

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    What's the problem in fact ?
    Can you describe it more what you should have and what do you have ?
  3. Offline

    booooo201

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    The java command does not work.
  4. Offline

    rominos2

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)

    This post has been edited 1 time. It was last edited by rominos2 Jun 30, 2012.
  5. Offline

    booooo201

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    /usr/java/jre1.7.0_05

    I'll take a look at the link.
  6. Offline

    rominos2

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Yeah you should use bash or shell script as it's written to add java to your path.
    And then the command will be available
  7. Offline

    booooo201

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Okay. Let me try it.
  8. Offline

    booooo201

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Now the alternative command does not work. Here is my .bashrc file:
    Code:
    # .bashrc
     
    # User specific aliases and functions
     
    alias rm='rm -i'
    alias cp='cp -i'
    alias mv='mv -i'
     
    # Source global definitions
    if [ -f /etc/bashrc ]; then
        . /etc/bashrc
    fi
    PATH ="$PATH":/usr/java/jre1.7.0_05/bin
    export PATH
  9. Offline

    rominos2

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    What are all these lines ?
    You just need :
    PATH="$PATH":/usr/local/jdk1.6.0/bin
    or
    set path="$PATH":/usr/local/jdk1.6.0/bin

    This post has been edited 1 time. It was last edited by rominos2 Jun 30, 2012.
  10. Offline

    booooo201

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Those lines were there.

    This post has been edited 1 time. It was last edited by booooo201 Jun 30, 2012.
  11. Offline

    rominos2

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Hmmmm yeah.
    It should work.
    Perhaps you need a reboot.
    I dunno
  12. Offline

    booooo201

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Now I get this error:

    -bash: /usr/bin/java: No such file or directory
  13. Offline

    rominos2

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    What are you doing exactly to get this error ?
  14. Offline

    booooo201

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I typed: java
  15. Offline

    rominos2

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Does it works with the long path when you type :
    /usr/java/jre.../bin/java .... ?
  16. Offline

    booooo201

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Yes it does. Only if i remove the set path thing.

    This post has been edited 1 time. It was last edited by booooo201 Jun 30, 2012.
  17. Online

    Sushi

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    This is what I do to install Java. I install the JDK, not the JRE. The JDK includes the JRE, but it includes other things such as a compiler. My distro is fedora, which is based on red hat (cent is also based on red hat).

    I use update-alternatives and it works fine, no need to mess with bashrc.
    1. Download java somehow... Oracle's download links are non-wget friendly and they are like ass, but the file you want is "jdk-7u5-linux-x64.tar.gz" or "jdk-7u5-linux-i586.tar.gz" if you are on a 32-bit system.
    2. Extract the tarball that contains the JDK.
      Code:
      tar -xvf jdk-7u5-linux-YOURARCH.tar.gz
      (replace YOURARCH with the architecture of the file you downloaded, i586 or x64)
    3. Run this to move your JDK folder to an appropriate location.
      Code:
      sudo mv ./jdk1.7.0_05 /usr/lib/jvm/jdk1.7.0
    4. Now use update-alternatives to register java, javac, and javaws.
      Code:
      sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1
      sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1
      sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1
    5. Configure update-alternatives and choose the correct path!

      Code:
      sudo update-alternatives --config java
      For --config java, the correct path would be "/usr/lib/jvm/jdk1.7.0/jre/bin/java", for example.

      Afterwards, you have to configure the other two executables.
      Code:
      sudo update-alternatives --config javac
      sudo update-alternatives --config javaws

    After you complete the installation, make sure you test your setup and make sure you are using the correct version of Java.

    Code:
    java --version

    This post has been edited 1 time. It was last edited by Sushi Jun 30, 2012.
    booooo201 likes this.
  18. Offline

    booooo201

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    That worked, thank you SO SO much!
    Sushi likes this.
  19. Offline

    rominos2

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Remember to change the title to Solved

    This post has been edited 1 time. It was last edited by rominos2 Jun 30, 2012.
  20. Offline

    booooo201

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
  21. Offline

    rominos2

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Thread Tool.
    Edit Thread.
    Write SOLVED close to the thread name

Share This Page