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:
sudo apt update
Install Maven by running the following command:
sudo apt install maven
This will install Maven and its dependencies.
Verify the installation by running the following command:
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:
yum list installed | grep java
或者
java -version
If Java is not installed, you will see an error message.
b. select yum list package version
yum search java | grep -i --color jdk
c. Install the default JDK package by running the following command:
yum install java-1.8.0-openjdk.x86_64
or
sudo apt install default-jdk
This will install the default JDK package available in the Ubuntu package repository.
d. Verify the installation by running the following command:
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:
java -version
This will display the JRE version.
e. jdk checkout version link
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/javac 1
f. use shell checkout version
sudo update-alternatives --config java
有 3 个候选项可用于替换 java (提供 /usr/bin/java)。
选择 路径 优先级 状态
------------------------------------------------------------
* 0 /usr/lib/jvm/java-17-openjdk-amd64/bin/java 1711 自动模式
1 /usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java 1 手动模式
2 /usr/lib/jvm/java-17-openjdk-amd64/bin/java 1711 手动模式
3 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 手动模式
要维持当前值[*]请按<回车键>,或者键入选择的编号:1
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.
本文由 note.batype.com 导入。
相关文章
- Docker 安装 Redis
在 Redis 命令行中,我们可以使用 config set 命令来设置 Redis 的密码。以下是设置密码的代码和注释。
- linux 配置缩写快捷操作
编辑~/.zshrc 增加自定义配置
- docker-compose install
需要将运行 yml 命名为 docker-compose.yml