程序员开发实例大全宝库

网站首页 > 编程文章 正文

一次看懂多种操作系统Java 开发环境的配置

zazugpt 2024-08-24 02:30:55 编程文章 15 ℃ 0 评论

Java 开发环境

  • Java Windows 开发环境配置
  • Java Linux 开发环境配置

Java Windows 开发环境配置

1、下载JDK

我们直接到管网下载

下载镜像:镜像地址/technetwork/java/javase/downloads/index.html

2、下载文件步骤

2.1选择JDK 版本(Java SE 8u201 / Java SE 8u202)

2.2同步协议选择(Windows x64 jdk-8u201-windows-x64.exe)

2.3点击jdk-8u201-windows-x64.exe 安装

2.4 安装路径的选择

2.5 jre 安装路径的选择

2.6 JDK 环境配置

我的电脑→右键→属性→高级系统设置→环境变量

变量设置

  • 新建系统变量【JAVA_HOME】:JDK根路径:D:\mainboot\Java\jdk1.8.0_201
  • 新建系统变量【CLASSPATH】:JDK的jar架包路径:.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.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)

2.2同步协议选择(Linux x64 jdk-8u201-linux-x64.tar.gz)

2.3选择保存

3、安装 JDK 步骤

3.1打开操作终端用命令安装

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 image
See 镜像地址/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
 

安装成功


希望我的分享可以帮助到你,如果你在内容技术上遇到难题,可以+关注■@主引教程 ,反馈给我们。我们会及时回复,如果有那些内容有误可以直接提出来,我们会及时纠正,谢谢来访。

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表