linux搭建服务器期末,linux搭建后端环境与服务器

编程入门 行业动态 更新时间:2024-10-23 22:22:24

linux搭建<a href=https://www.elefans.com/category/jswz/34/1771423.html style=服务器期末,linux搭建后端环境与服务器"/>

linux搭建服务器期末,linux搭建后端环境与服务器

解压JDK

设置存放路径为/opt(可自定义),进入到root账户,将下载好的JDK文件拷贝到/opt目录

cp jdk-8u144-linux-i586.tar.gz /opt

解压

tar zxvf jdk-8u144-linux-i586.tar.gz

等待一段时间,JDK就解压完成了。JDK目录下有以下文件

设置环境变量

在/etc/profile中进行JDK环境变量的编辑。

vi /etc/profile

在文件的最后加入以下几行(对应的位置填你的JDK解压目录)【注意不要输错】

export JAVA_HOME=/opt/jdk1.8.0_144

export JRE_HOME=/opt/jdk1.8.0_144/jre

export PATH=$JAVA_HOME/bin:$PATH

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

配置完成之后,一定记得要用命令source /etc/profile刷新配置文件,让配置文件生效!!!

检验是否安装成功

在终端输入java,出现以下界面说明已经安装配置成功了!恭喜!

root@ubuntu:~$ 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

-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 .html for more details.

编写一个java文件测试

编辑Hello.java文件

public class Hello{

public static void main(String[] args){

System.out.println("Hello World!");

}

}

编译:javac Hello.java

执行:java Hello

顺利输出:Hello World!

至此,JDK的配置已经完成!

更多推荐

linux搭建服务器期末,linux搭建后端环境与服务器

本文发布于:2024-03-11 20:06:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1729799.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:服务器   期末   后端   环境   linux

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!