JDK Configuration in Ubuntu Server(Ubuntu的jdk配置)

If you want to create Java Program in Ubuntu, the first thing is to configuring JDK. And that what this page will tell you.


  • JDK preparing

Above all, prepare a tar.gz JDK package. If you don't want to download it from the official website, a mirror website is a good choice: http://repo.huaweicloud.com/java/jdk.
You can use wget or VMware shared folders or even a U-disk to put it into your Ubuntu disk.

Ubuntu:~$ ls /home/user/temp
jdk-8u212-linux-x64.tar.gz

And here I prepared a jdk-8u212-linux-x64.tar.gz in /home/user/temp.


  • Archive unpacking

Use the command:

Ubuntu:~$ tar -zxf /home/user/temp/jdk-8u212-linux-x64.tar.gz -C unpackpath

The parameter unpackpath after -C is to indicate the path of your unpacked files or folders.


  • Environment variables configuration

Use the command:

Ubuntu:~$ sudo vim /etc/profile

open the file and add the following content to it:

JAVA_HOME=unpackpath/jdk1.8.0_212
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin

and then use the command:

Ubuntu:~$ sudo source /etc/profile

to validate the modification.


  • Configuration confirming

Use the command:

Ubuntu:~$ java -version

to confirm the jdk and java version, if you configured it successfully, the interface will be shown as:

java version "1.8.0_212"
Java(TM) SE Runtime Environment (Build 1.8.0_212-b10)
Java HotSpot(TM) 64Bit Server VM (build 25.212-b10, mixed mode)
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 本文转载自知乎 作者:季子乌 笔记版权归笔记作者所有 其中英文语句取自:英语流利说-懂你英语 ——————————...
    Danny_Edward阅读 43,964评论 4 38
  • Chapter 1 In the year 1878, I took my degree of Doctor of...
    foxgti阅读 3,854评论 0 6
  • 今天参加了学校的家长课堂,在此学到了很多,比如老师讲的,假期要有明确的计划。家长与孩子共同定制计划等。 家长会...
    赵文博415阅读 372评论 0 0
  • 《恋恋笔记本》第四页: 破天荒的在公园听了两场戏。 天气炎热。不敢开空调,只好摇蒲扇,大蒲叶的...
    Laogao13阅读 184评论 0 0
  • 序: 夜,卷成,顿觉荒唐不堪,不知所谓。遥想多年意,思绪万千,遂吐槽了数语! 笔下长卷铺陈案,满纸荒唐。行间...
    孤行迹阅读 865评论 14 23