Java 开发环境
![4832f6ddaa3a4cb49cf1ea1679913814.png](https://img-blog.csdnimg.cn/img_convert/4832f6ddaa3a4cb49cf1ea1679913814.png)
- Java Windows 开发环境配置
- Java Linux 开发环境配置
Java Windows 开发环境配置
1、下载JDK
我们直接到管网下载
下载镜像:镜像地址/technetwork/java/javase/downloads/index.html
2、下载文件步骤
2.1选择JDK 版本(Java SE 8u201 / Java SE 8u202)
![4ffdcaf644aa52ed56586e0edd8b024d.png](https://img-blog.csdnimg.cn/img_convert/4ffdcaf644aa52ed56586e0edd8b024d.png)
2.2同步协议选择(Windows x64 jdk-8u201-windows-x64.exe)
![0e42ccb35313f96415048619cbdfa011.png](https://img-blog.csdnimg.cn/img_convert/0e42ccb35313f96415048619cbdfa011.png)
2.3点击jdk-8u201-windows-x64.exe 安装
![dd297518b3459689cfc06b00b5bce799.png](https://img-blog.csdnimg.cn/img_convert/dd297518b3459689cfc06b00b5bce799.png)
2.4 安装路径的选择
![8098ac7093860418696897f5689169df.png](https://img-blog.csdnimg.cn/img_convert/8098ac7093860418696897f5689169df.png)
![89494dade0dfd026afd4643a7d993caa.png](https://img-blog.csdnimg.cn/img_convert/89494dade0dfd026afd4643a7d993caa.png)
![b5e97c1501c87e4e206911578bf3c35f.png](https://img-blog.csdnimg.cn/img_convert/b5e97c1501c87e4e206911578bf3c35f.png)
2.5 jre 安装路径的选择
![47d667a65c6b346b96c86fbc3a336e10.png](https://img-blog.csdnimg.cn/img_convert/47d667a65c6b346b96c86fbc3a336e10.png)
![a4985fc70316ba2d20590ae4dcc8bbc3.png](https://img-blog.csdnimg.cn/img_convert/a4985fc70316ba2d20590ae4dcc8bbc3.png)
2.6 JDK 环境配置
我的电脑→右键→属性→高级系统设置→环境变量
![e036cd29d743cddfb5c0543f61a16073.png](https://img-blog.csdnimg.cn/img_convert/e036cd29d743cddfb5c0543f61a16073.png)
变量设置
![e036cd29d743cddfb5c0543f61a16073.png](https://img-blog.csdnimg.cn/img_convert/e036cd29d743cddfb5c0543f61a16073.png)
- 新建系统变量【JAVA_HOME】:JDK根路径:D:mainbootJavajdk1.8.0_201
- 新建系统变量【CLASSPATH】:JDK的jar架包路径:.;%JAVA_HOME%libdt.jar;%JAVA_HOME%libools.jar;
- 【PATH】环境变量中追加Java环境变量: ;%JAVA_HOME%bin
输入cmd,进入dos命令框中输入javac和java
安装成功
Java Linux 开发环境配置
1、下载JDK
我们直接到管网下载
下载镜像:镜像地址/technetwork/java/javase/downloads/index.html
2、下载文件步骤
2.1选择JDK 版本(Java SE 8u201 / Java SE 8u202)
![4ffdcaf644aa52ed56586e0edd8b024d.png](https://img-blog.csdnimg.cn/img_convert/4ffdcaf644aa52ed56586e0edd8b024d.png)
2.2同步协议选择(Linux x64 jdk-8u201-linux-x64.tar.gz)
![0e42ccb35313f96415048619cbdfa011.png](https://img-blog.csdnimg.cn/img_convert/0e42ccb35313f96415048619cbdfa011.png)
2.3选择保存
![87e242b291926f24c351adfde9b5d1f3.png](https://img-blog.csdnimg.cn/img_convert/87e242b291926f24c351adfde9b5d1f3.png)
3、安装 JDK 步骤
3.1打开操作终端用命令安装
![c2a7d2c4c9539ca90e329ca731eb0e0e.png](https://img-blog.csdnimg.cn/img_convert/c2a7d2c4c9539ca90e329ca731eb0e0e.png)
3.2创建目录
mkdir -p /mnt/mainboot/env/
3.3把下载文件移到新建目录
mv ../Downloads/jdk-8u201-linux-x64.tar.gz /mnt/mainboot/env/
3.4进入新建目录
cd /mnt/mainboot/env/
3.5解压文件
tar -zxvf jdk-8u201-linux-x64.tar.gz
3.6 设置JDK配置变量,在profile文件后面追加
vim /etc/profile
export JAVA_HOME=/mnt/mainboot/env/jdk1.8.0_201 export PATH=.:$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
3.7 执行生效
source /etc/profile
3.8测试安装是否成功
java
Usage: java [-options] class [args...] (to execute a class) or java [-options] -jar jarfile [args...] (to execute a jar file)where options include: -d32 use a 32-bit data model if available -d64 use a 64-bit data model if available -server to select the "server" VM The default VM is server. -cp -classpath A : separated list of directories, JAR archives, and ZIP archives to search for class files. -D= set a system property -verbose:[class|gc|jni] enable verbose output -version print product version and exit -version: Warning: this feature is deprecated and will be removed in a future release. require the specified version to run -showversion print product version and continue -jre-restrict-search | -no-jre-restrict-search Warning: this feature is deprecated and will be removed in a future release. include/exclude user private JREs in the version search -? -help print this help message -X print help on non-standard options -ea[:...|:] -enableassertions[:...|:] enable assertions with specified granularity -da[:...|:] -disableassertions[:...|:] disable assertions with specified granularity -esa | -enablesystemassertions enable system assertions -dsa | -disablesystemassertions disable system assertions -agentlib:[=] load native agent library , e.g. -agentlib:hprof see also, -agentlib:jdwp=help and -agentlib:hprof=help -agentpath:[=] load native agent library by full pathname -javaagent:[=] load Java programming language agent, see java.lang.instrument -splash: show splash screen with specified imageSee 镜像地址/technetwork/java/javase/documentation/index.html for more details.
javac
Usage: javac where possible options include: -g Generate all debugging info -g:none Generate no debugging info -g:{lines,vars,source} Generate only some debugging info -nowarn Generate no warnings -verbose Output messages about what the compiler is doing -deprecation Output source locations where deprecated APIs are used -classpath Specify where to find user class files and annotation processors -cp Specify where to find user class files and annotation processors -sourcepath Specify where to find input source files -bootclasspath Override location of bootstrap class files -extdirs Override location of installed extensions -endorseddirs Override location of endorsed standards path -proc:{none,only} Control whether annotation processing and/or compilation is done. -processor [,,...] Names of the annotation processors to run; bypasses default discovery process -processorpath Specify where to find annotation processors -parameters Generate metadata for reflection on method parameters -d Specify where to place generated class files -s Specify where to place generated source files -h Specify where to place generated native header files -implicit:{none,class} Specify whether or not to generate class files for implicitly referenced files -encoding Specify character encoding used by source files -source Provide source compatibility with specified release -target Generate class files for specific VM version -profile Check that API used is available in the specified profile -version Version information -help Print a synopsis of standard options -Akey[=value] Options to pass to annotation processors -X Print a synopsis of nonstandard options -J Pass directly to the runtime system -Werror Terminate compilation if warnings occur @ Read options and filenames from file
安装成功
希望我的分享可以帮助到你,如果你在内容技术上遇到难题,可以+关注■@主引教程 ,反馈给我们。我们会及时回复,如果有那些内容有误可以直接提出来,我们会及时纠正,谢谢来访。