目录
JDK
简介
JDK:java development kit (java开发工具)
JDK / JRE / JVM 区别
- JRE:java runtime environment (java运行时环境)
- JVM:java virtuak machine (java虚拟机)
- 一般来讲
- JDK 会包含 JRE 和 JVM
- JRE 会包含 JVM
环境
- ubuntu - 20.04
- Win11
- JDK - 17.0.2
官网下载
- https://www.oracle.com/java/
- 如图即可找到jdk的下载
- linux系统
- 后缀为tar.gz的下载后上传到linux(建议使用WinSCP),然后解压
- linux解压tar.gz命令:tar -zxvf 压缩包名.tar.gz
- 其他类型的根据对应系统的安装命令执行即可
- linux的JAVA环境变量配置
- 后缀为tar.gz的下载后上传到linux(建议使用WinSCP),然后解压
- Win
- 后缀为zip的压缩包下载后需要同Linux的tar.gz类型的操作一致(见本文的上文)
- 后缀是exe的就是有图形界面的安装程序,新手可以用这个,安装比较简单
- 像我的习惯是在win也使用zip压缩包,因为这个在同时安装多个java版本时,配置环境变量挺简单的,安装程序的环境变量配置没试过。
- 如果你使用的是压缩包,则需要:win的JAVA环境变量配置
- 如果你使用的是安装程序,则跟着安装程序走就可以了。
配置环境变量
当我们在cmd命令行敲命令时,cmd如何知道这个命令对应的可执行文件在哪里?这就要配置环境变量来告诉cmd去哪里找。当然环境变量还有其他用途,比如我们下面配置的CLASSPATH就关系到javac的编译。
Linux
- 修改配置文件 /etc/profile
- # vi /etc/profile
- 然后按大写的 G,就会跳到文件末尾
- 按 i,进入编辑模式
- 配置JAVA_HOME
- 输入:
- JAVA_HOME = 刚刚解压的java文件夹目录
- 比如:JAVA_HOME=/home/0Acoolight/java/jdk-17.0.1
- 注意:这个java路径的下一级就包含bin,conf等目录和文件,千万不能搞错了。
- 配置这个可以让你在cmd的任意目录下都可以执行 java / javac 命令。
- 比如:java -version ;javac -version 等。
- 输入:
- 配置CLASSPATH
- 这个是固定的,你也可以在这里加附加的jar包,新手复制下面的内容进去就可以了。
- CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib
- 配置这个是给 javac 编译时用的。
- 配置PATH
- 直接复制进去即可
- PATH=$JAVA_HOME/bin:$PATH
- 最后设置PATH生效:
- export PATH
- 完成后就是这个样子:
- 保存退出
- 按英文的冒号 :
- 输入wq,然后回车即可保存退出vi并回到cmd。
- 令配置文件生效:
- # source /etc/profile
- 测试是否成功
Win
- 按 win + i 打开设置
- 点 高级系统设置
- 点 环境变量
- 点 新建
- 输入变量名:JAVA_HOME
- 输入变量值:刚刚的java压缩包解压后的目录
- 注意:这个变量值的目录的下一级就包含着bin conf等目录,千万不能错
- 再点一次新建:
- 输入变量名:CLASSPATH
- 输入变量值:.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar
- 强烈建议复制进去,注意变量值的最前面,是有一个英文的句号 . 和分号 ;
- 修改Path
- 在系统变量里找变量名为 Path 的那一行
- 选中它,然后点编辑
- 点 新建
- 输入 %JAVA_HOME%\bin
- 点上移,直到刚刚新建的那一行到第一行
- 最后点确定即可
- 至此环境变量配置就完成了
- 测试是否成功:
- 如果你已经打开cmd,请关掉重开或者重新开一个,然后进行下面的测试。
测试是否成功
- 在cmd输入 java -version,然后回车
- 在cmd输入 javac -version,然后回车
- 如果配置成功,效果如图:
- 由于你的java版本号不一定和我一样,所以只要提示信息不是报错就行。
多个JAVA版本的配置
由于有些软件对JAVA版本有要求,所以可以会要安装多个JAVA版本。
- 思路:
- 还记得我们之前配置的环境变量 JAVA_HOME 吗
- 我们只需要搞一个多个中间变量去指向各自的java版本的路径,然后想启动哪个版本就让JAVA_HOME指向哪个中间环境变量即可。
- 实践:
win环境:
- 比如我同时安装了 JAVA8 和 JAVA17:
- 那么就先新建两个中间环境变量:JAVA8_HOME 和 JAVA17_HOME ,并输入对应的JAVA所在路径。
- 然后修改环境变量:JAVA_HOME
- 比如我现在想要使用JAVA17,那就把JAVA_HOME的变量值改为 %JAVA17_HOME%
- 如果我又想用回JAVA8,则把JAVA_HOME的变量值改为 %JAVA8_HOME%
- 到这里就完成了,打开cmd,输入:java -verison 查看java版本
linux环境
- linux和win基本一致,不过要注意:
- 变量值引用变量时,win下写%JAVA17_HOME%,linux要写$JAVA17_HOME
- 路径分隔在win下是分号 ; ,在linux是冒号 :
- 路径在win下是反斜杠 \ ,在linux是斜杠 /
- 保存并退出vi后,在cmd执行命令让配置文件生效:
- # source /etc/profile
- 如图是使用JAVA17。如果想使用JAVA8:
- 把 JAVA_HOME=$JAVA17_HOME
- 改为JAVA_HOME=$JAVA8_HOME
buy cytotec over the counter buy cytotec online fast delivery buy misoprostol over the counter
https://propeciabestprice.pro/# buy generic propecia no prescription
Backgammon is a popular ancient board game. It is played with two players (lucky you, we have a computer player to enjoy!). The object of backgammon is to move all your checkers around the board in a clockwise motion and ultimately bear off the checkers from the board. The first player to remove all their checkers is the winner. Bonus bombs are one of the best features of the Word Wipe puzzle game. Why? Because they give you the chance to clear more words, earn more points, and achieve a higher score. Word Search is a game composed of the letters of words formatted in a grid. Generally the word game grid is rectangular or square in nature. The goal is to find and highlight all of the words hidden in the puzzle. The words may be placed diagonally, horizontally, vertically, or backwards. All of the hidden words can be found in a list alongside the grid. Each word from the list will become a “muted” state after it has been highlighted in the puzzle.
https://gunnertjtd221112.activoblog.com/27566627/manual-article-review-is-required-for-this-article
What’s Included: Monopoly board gameSuitable Age: 8+Best For: Toys & Games, CollectiblesOverall Satisfaction Rating: ★★★★★Why We Like It: Monopoly meets Dragon Ball Super in this exciting twist on the classic board game.With my favorite Z fighter, this board game lets me enjoy an hour or two of fun, competitive game nights with friends, family, and fellow DBZ fans.Key Features: Let us do in hyperbole a bit by claiming that Dragon Ball FighterZ is most likely the best game in the history of the franchise. It has been a year since Dragon Ball Z: Kakarot came into our hands, a game desired by many for what it wanted to offer: the maximum possible fidelity to the Toei anime. And we can say that it succeeds: Kakarot is an extremely faithful game, which likes to recreate itself in mythical details and dialogue and that covers all the events of Z, as well as some originals. The combat system is not as deep as we would like, it is true, and the DLC has turned out worse than expected, but it is the most faithful game to recreate the great events of Toriyama’s work, and a great starting point for future Action RPG-type deliveries that can give the gameplay a boost.
Misoprostol 200 mg buy online cytotec pills buy online buy cytotec pills
https://zithromaxbestprice.pro/# can i buy zithromax over the counter in canada
http://zithromaxbestprice.pro/# where can i buy zithromax uk
prednisone 5mg capsules: cheap generic prednisone – prednisone 30 mg daily
get generic propecia pill buying propecia without insurance cost of cheap propecia pill
http://propeciabestprice.pro/# cost cheap propecia
https://propeciabestprice.pro/# buy cheap propecia online
purchase cytotec: cytotec abortion pill – buy cytotec pills
can you buy zithromax over the counter zithromax over the counter canada can you buy zithromax over the counter in australia
https://cytotecbestprice.pro/# Cytotec 200mcg price
http://propeciabestprice.pro/# cost of propecia prices
can i buy zithromax over the counter in canada: zithromax cost – zithromax for sale 500 mg
cost of tamoxifen tamoxifen and osteoporosis tamoxifen hip pain
http://cytotecbestprice.pro/# buy misoprostol over the counter
http://nolvadexbestprice.pro/# nolvadex only pct
buy generic zithromax no prescription: zithromax over the counter canada – zithromax capsules 250mg
generic zithromax india generic zithromax 500mg zithromax online no prescription
mexico drug stores pharmacies: п»їbest mexican online pharmacies – medication from mexico pharmacy
mexico drug stores pharmacies: mexican drugstore online – medication from mexico pharmacy
п»їbest mexican online pharmacies: mexico pharmacies prescription drugs – п»їbest mexican online pharmacies
mexican pharmaceuticals online best online pharmacies in mexico buying prescription drugs in mexico online
reputable mexican pharmacies online: medicine in mexico pharmacies – buying prescription drugs in mexico online
mexico pharmacies prescription drugs: mexican drugstore online – mexican online pharmacies prescription drugs
reputable mexican pharmacies online purple pharmacy mexico price list best online pharmacies in mexico
mexico pharmacies prescription drugs: purple pharmacy mexico price list – п»їbest mexican online pharmacies
mexican online pharmacies prescription drugs: mexican rx online – buying from online mexican pharmacy
mexico pharmacies prescription drugs: buying from online mexican pharmacy – mexican pharmaceuticals online
mexico pharmacies prescription drugs: medication from mexico pharmacy – buying prescription drugs in mexico
medication from mexico pharmacy: mexican pharmaceuticals online – buying prescription drugs in mexico online
mexican pharmaceuticals online: mexican mail order pharmacies – п»їbest mexican online pharmacies
mexican pharmaceuticals online reputable mexican pharmacies online mexican mail order pharmacies
buying prescription drugs in mexico online: buying prescription drugs in mexico – mexican drugstore online
mexico pharmacies prescription drugs: mexican drugstore online – buying prescription drugs in mexico
medicine in mexico pharmacies medication from mexico pharmacy mexico drug stores pharmacies
mexican pharmaceuticals online: mexico pharmacies prescription drugs – mexican online pharmacies prescription drugs
buying prescription drugs in mexico: mexican online pharmacies prescription drugs – medication from mexico pharmacy
п»їbest mexican online pharmacies: п»їbest mexican online pharmacies – mexican rx online
п»їbest mexican online pharmacies: reputable mexican pharmacies online – buying from online mexican pharmacy
mexico drug stores pharmacies: purple pharmacy mexico price list – reputable mexican pharmacies online
mexico drug stores pharmacies: mexico pharmacies prescription drugs – mexico pharmacies prescription drugs
reputable mexican pharmacies online: mexican drugstore online – buying from online mexican pharmacy
mexican border pharmacies shipping to usa: mexican drugstore online – mexican pharmaceuticals online
mexico drug stores pharmacies buying from online mexican pharmacy mexico drug stores pharmacies
mexican mail order pharmacies: mexico pharmacies prescription drugs – mexican border pharmacies shipping to usa
mexican online pharmacies prescription drugs: buying prescription drugs in mexico online – mexican online pharmacies prescription drugs
mexican pharmaceuticals online mexican rx online mexican pharmacy
mexico drug stores pharmacies: mexico drug stores pharmacies – mexican pharmaceuticals online