Installing Java 7 on Ubuntu

后端 未结 10 1370
温柔的废话
温柔的废话 2020-11-29 14:12

to install java I have always used the classic way from the terminal. I would like to install java manually. I placed the folder of the JDK on the desk and I set environment

10条回答
  •  既然无缘
    2020-11-29 14:55

    I think you should consider Java installation procedure carefully. Following is the detailed process which covers almost all possible failures.

    Installing Java with apt-get is easy. First, update the package index:

    sudo apt-get update
    

    Then, check if Java is not already installed:

    java -version
    

    If it returns "The program java can be found in the following packages", Java hasn't been installed yet, so execute the following command:

    sudo apt-get install default-jre
    

    You are fine till now as I assume.

    This will install the Java Runtime Environment (JRE). If you instead need the Java Development Kit (JDK), which is usually needed to compile Java applications (for example Apache Ant, Apache Maven, Eclipse and IntelliJ IDEA execute the following command:

    sudo apt-get install default-jdk
    

    That is everything that is needed to install Java.

    Installing OpenJDK 7:

    To install OpenJDK 7, execute the following command:

    sudo apt-get install openjdk-7-jre 
    

    This will install the Java Runtime Environment (JRE). If you instead need the Java Development Kit (JDK), execute the following command:

    sudo apt-get install openjdk-7-jdk
    

    Installing Oracle JDK:

    The Oracle JDK is the official JDK; however, it is no longer provided by Oracle as a default installation for Ubuntu.

    You can still install it using apt-get. To install any version, first execute the following commands:

    sudo apt-get install python-software-properties
    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    

    Then, depending on the version you want to install, execute one of the following commands:

    Oracle JDK 7:

    sudo apt-get install oracle-java7-installer
    

    Oracle JDK 8:

    sudo apt-get install oracle-java8-installer
    

提交回复
热议问题