Guide to Offline Installation of JDK 17 on Ubuntu

Guide to Offline Installation of JDK 17 on Ubuntu

This tutorial is based on Ubuntu 20.04.

JDK Installation

  1. Go to Oracle website and download the JDK version that matches your operating system architecture. Ubuntu users can choose either Debian Package or Compressed Archive. In this example, we choose the Compressed Archive.

    1_official_website

  2. Drag and drop the downloaded file jdk-17.0.7_linux-x64_bin.tar.gz to the target directory, such as /root.

  3. Navigate to the target directory /root and run the following command to extract the file:

    tar -xf jdk-17.0.7_linux-x64_bin.tar.gz
    
  4. The above command extracts jdk-17.0.7_linux-x64_bin.tar.gz into a directory named jdk-17.0.7. You can rename this directory to a more suitable name. For example, if you want to rename it to jdk-17, you can use the following command:

    mv jdk-17.0.7 jdk-17

  5. You can move the JDK directory to the desired installation location. For instance, you can use the following command to move it to the /usr/lib/jvm/ directory:

    sudo mv jdk-17 /usr/lib/jvm/

  6. Set the environment variables to use the newly installed JDK. Open the /etc/environment file in a text editor. You can use nano or vim command.

  7. Add the following code to the file, under PATH, for the JAVA_HOME environment variable. Replace it with the actual directory name if you didn’t rename it to jdk-17 in step 4:

    JAVA_HOME="/usr/lib/jvm"
    PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:$JAVA_HOME/bin"

  8. Save the file and exit the text editor.

  9. Apply the changes to the environment by executing the following command:

    source /etc/environment

  10. Verify if the JDK has been installed and configured correctly by running the following command:

    java -version

    If the JDK has been installed correctly, this command should display the installed Java version and other relevant information.

By following these steps, you should be able to deploy the Linux x64 JDK compressed version (jdk-17.0.7_linux-x64_bin.tar.gz) on your Ubuntu 20.04 machine.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值