ubantu 安装 Maven 和 jdk 步骤
To install Maven and JDK (Java Development Kit) on Ubuntu, you can follow these steps:
Open a terminal on your Ubuntu system.
Update the package lists by running the following command:
1 | sudo apt update |
Install Maven by running the following command:
1 | sudo apt install maven |
This will install Maven and its dependencies.
Verify the installation by running the following command:
1 | mvn --version |
This should display the version of Maven installed on your system.
Install JDK (Java Development Kit) using the following steps:
a. Check if Java is already installed on your system by running the following command:
1 | yum list installed | grep java |
If Java is not installed, you will see an error message.
b. select yum list package version
1 | yum search java | grep -i --color jdk |
c. Install the default JDK package by running the following command:
1 | yum install java-1.8.0-openjdk.x86_64 |
This will install the default JDK package available in the Ubuntu package repository.
d. Verify the installation by running the following command:
1 | javac -version |
This should display the version of the JDK installed on your system.
Additionally, you can also run the following command to check the Java Runtime Environment (JRE) version:
1 | java -version |
This will display the JRE version.
e. jdk checkout version link
1 | sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java 1 |
f. use shell checkout version
1 | sudo update-alternatives --config java |
That’s it! You have now installed Maven and JDK on your Ubuntu system. You can use Maven for building projects and the JDK for developing and running Java applications.