首页 / JAVA / Linux安装Java
Linux安装Java
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Linux安装Java,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含5267字,纯文字阅读大概需要8分钟。
内容图文
链接:https://pan.baidu.com/s/1toRsLHRmjQcFvEp--1fEJA
提取码:e240
1:使用xftp将java压缩包上传到/usr/local/mysoft 目录下
2:cd /usr/local/mysoft 进入mysoft目录
[root@localhost mysoft]# ls
jdk-8u212-linux-x64.tar.gz mysql
3:tar -zxvf jdk-8u212-linux-x64.tar.gz,解压我们上传的压缩包,完成后ls查看mysoft目录
[root@localhost mysoft]# ls
jdk1.8.0_212 jdk-8u212-linux-x64.tar.gz mysql
4:vim /etc/profile 配置java环境变量,在配置文件中新增如下内容(一定要将JAVA_PATH添加到path中)
#配置java export JAVA_HOME=/usr/local/mysoft/jdk1.8.0_212 export JRE_HOME=${JAVA_HOME}/jre export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH export PATH=$PATH:${JAVA_PATH}
5:source /etc/profile 使配置文件生效
6:java -version
[root@localhost mysoft]# java -version java version "1.8.0_212" Java(TM) SE Runtime Environment (build 1.8.0_212-b10) Java HotSpot(TM) 64-Bit Server VM (build 25.212-b10, mixed mode)
7:java
[root@localhost mysoft]# 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 -client to select the "client" VM -server to select the "server" VM -minimal to select the "minimal" VM The default VM is client. -cp <class search path of directories and zip/jar files> -classpath <class search path of directories and zip/jar files> A : separated list of directories, JAR archives, and ZIP archives to search forclass files. -D<name>=<value> set a system property -verbose:[class|gc|jni] enable verbose output -version print product version and exit -version:<value> 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[:<packagename>...|:<classname>] -enableassertions[:<packagename>...|:<classname>] enable assertions with specified granularity -da[:<packagename>...|:<classname>] -disableassertions[:<packagename>...|:<classname>] disable assertions with specified granularity -esa | -enablesystemassertions enable system assertions -dsa | -disablesystemassertions disable system assertions -agentlib:<libname>[=<options>] load native agent library <libname>, e.g. -agentlib:hprof see also, -agentlib:jdwp=help and -agentlib:hprof=help -agentpath:<pathname>[=<options>] load native agent library by full pathname -javaagent:<jarpath>[=<options>] load Java programming language agent, see java.lang.instrument -splash:<imagepath> show splash screen with specified image See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
8:javac
[root@localhost mysoft]# javac Usage: javac <options> <source files> 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 <path> Specify where to find user class files and annotation processors -cp <path> Specify where to find user class files and annotation processors -sourcepath <path> Specify where to find input source files -bootclasspath <path> Override location of bootstrap class files -extdirs <dirs> Override location of installed extensions -endorseddirs <dirs> Override location of endorsed standards path -proc:{none,only} Control whether annotation processing and/or compilation is done. -processor <class1>[,<class2>,<class3>...] Names of the annotation processors to run; bypasses default discovery process -processorpath <path> Specify where to find annotation processors -parameters Generate metadata for reflection on method parameters -d <directory> Specify where to place generated class files -s <directory> Specify where to place generated source files -h <directory> Specify where to place generated native header files -implicit:{none,class} Specify whether or not to generate class files for implicitly referenced files -encoding <encoding> Specify character encoding used by source files -source <release> Provide source compatibility with specified release -target <release> Generate class files for specific VM version -profile <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<flag> Pass <flag> directly to the runtime system -Werror Terminate compilation if warnings occur @<filename> Read options and filenames from file
9:如果你的第6,7,8三步都没有报错,并出现相关信息,则说明你的java环境配置成功
原文:https://www.cnblogs.com/misterwu/p/12812705.html
内容总结
以上是互联网集市为您收集整理的Linux安装Java全部内容,希望文章能够帮你解决Linux安装Java所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。