久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

CentOS JAVA安裝及查看路徑方法

 東門大官1人 2018-06-19

一、安裝:

方法一:手動(dòng)解壓JDK的壓縮包,然后設(shè)置環(huán)境變量

1.在/usr/目錄下創(chuàng)建java目錄

[root@localhost ~]# mkdir/usr/java
[root@localhost ~]# cd /usr/java

2.下載jdk,然后解壓

[root@localhost java]# curl -O http://download.Oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz 
[root@localhost java]# tar -zxvf jdk-7u79-linux-x64.tar.gz

3.設(shè)置環(huán)境變量

[root@localhost java]# vi /etc/profile

在profile中添加如下內(nèi)容:

#set java environment
JAVA_HOME=/usr/java/jdk1.7.0_79
JRE_HOME=/usr/java/jdk1.7.0_79/jre
CLASS_PATH=.:JAVAHOME/lib/dt.jar:JAVA_HOME/lib/tools.jar:JREHOME/libPATH=PATH:JAVAHOME/bin:JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH

讓修改生效:

[root@localhost java]# source /etc/profile

4.驗(yàn)證JDK有效性

[root@localhost java]# java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

方法二:用yum安裝JDK

1.查看yum庫(kù)中都有哪些jdk版本(暫時(shí)只發(fā)現(xiàn)了openjdk)

[root@localhost ~]# yum search java|grep jdk
ldapjdk-javadoc.x86_64 : Javadoc for ldapjdk
java-1.6.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.6.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.6.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.6.0-openjdk-javadoc.x86_64 : OpenJDK API Documentation
java-1.6.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.7.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.7.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.7.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.7.0-openjdk-javadoc.noarch : OpenJDK API Documentation
java-1.7.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.8.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.8.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.8.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.8.0-openjdk-headless.x86_64 : OpenJDK Runtime Environment
java-1.8.0-openjdk-javadoc.noarch : OpenJDK API Documentation
java-1.8.0-openjdk-src.x86_64 : OpenJDK Source Bundle
ldapjdk.x86_64 : The Mozilla LDAP Java SDK

2.選擇版本,進(jìn)行安裝

//選擇1.7版本進(jìn)行安裝
[root@localhost ~]# yum install java-1.7.0-openjdk
//安裝完之后,,默認(rèn)的安裝目錄是在: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64

3.設(shè)置環(huán)境變量

[root@localhost ~]# vi /etc/profile

在profile文件中添加如下內(nèi)容

#set java environment
JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64
JRE_HOME=JAVAHOME/jreCLASSPATH=.:JAVA_HOME/lib/dt.jar:JAVAHOME/lib/tools.jar:JRE_HOME/lib
PATH=PATH:JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH

讓修改生效

[root@localhost java]# source /etc/profile

4.驗(yàn)證(同上一方法)

方法三:用rpm安裝JDK

1.下載rpm安裝文件

[root@localhost ~]$ curl -O http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.rpm

2.使用rpm命令安裝

[root@localhost  ~]# rpm -ivh jdk-7u79-linux-x64.rpm

3.設(shè)置環(huán)境變量

[root@localhost java]# vi /etc/profile

在打開的profile文件中添加如下內(nèi)容

#set java environment
JAVA_HOME=/usr/java/jdk1.7.0_79
JRE_HOME=/usr/java/jdk1.7.0_79/jre
CLASS_PATH=.:JAVAHOME/lib/dt.jar:JAVA_HOME/lib/tools.jar:JREHOME/libPATH=PATH:JAVAHOME/bin:JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH

讓修改生效

[root@localhost java]# source /etc/profile

4.驗(yàn)證(同上一方法)

注:和yum安裝類似,,不用設(shè)置環(huán)境變量就可以運(yùn)行java命令,。rpm安裝方式默認(rèn)會(huì)把jdk安裝到/usr/java/jdk1.7.0_79,,然后通過(guò)三層鏈接,,鏈接到/usr/bin,具體鏈接如下:

[root@localhost ~]# cd /bin
[root@localhost bin]# ll|grep java
lrwxrwxrwx. 1 root root    25 Mar 28 11:24 jar ->/usr/java/default/bin/jar
lrwxrwxrwx. 1 root root    26 Mar 28 11:24 java -> /usr/java/default/bin/java
lrwxrwxrwx. 1 root root    27 Mar 28 11:24 javac ->/usr/java/default/bin/javac
lrwxrwxrwx. 1 root root    29 Mar 28 11:24 javadoc ->/usr/java/default/bin/javadoc
lrwxrwxrwx. 1 root root    28 Mar 28 11:24 javaws ->/usr/java/default/bin/javaws
lrwxrwxrwx. 1 root root    30 Mar 28 11:24 jcontrol ->/usr/java/default/bin/jcontrol
[root@localhost bin]# cd /usr/java/
[root@localhost java]# ll
total 4
lrwxrwxrwx. 1 root root  16 Mar 28 11:24 default-> /usr/java/latest
drwxr-xr-x. 8 root root 4096 Mar 28 11:24 jdk1.7.0_79
lrwxrwxrwx. 1 root root  21 Mar 28 11:24 latest -> /usr/java/jdk1.7.0_79

方法四:Ubuntu 上使用apt-get安裝JDK

1.查看apt庫(kù)都有哪些jdk版本

root@linuxidc:~# apt-cache search java|grep jdk
default-jdk - Standard Java or Java compatible Development Kit
default-jdk-doc - Standard Java or Java compatible Development Kit (documentation)
gcj-4.6-jdk - gcj and classpath development tools for Java(TM)
gcj-jdk - gcj and classpath development tools for Java(TM)
openjdk-6-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-6-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-6-doc - OpenJDK Development Kit (JDK) documentation
openjdk-6-jdk - OpenJDK Development Kit (JDK)
openjdk-6-jre-lib - OpenJDK Java runtime (architecture independent libraries)
openjdk-6-source - OpenJDK Development Kit (JDK) source files
openjdk-7-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-7-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-7-doc - OpenJDK Development Kit (JDK) documentation
openjdk-7-jdk - OpenJDK Development Kit (JDK)
openjdk-7-source - OpenJDK Development Kit (JDK) source files
uwsgi-plugin-jvm-openjdk-6 - Java plugin for uWSGI (OpenJDK 6)
uwsgi-plugin-jwsgi-openjdk-6 - JWSGI plugin for uWSGI (OpenJDK 6)
openjdk-6-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-6-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-7-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-7-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-7-jre-lib - OpenJDK Java runtime (architecture independent libraries)

2.選擇版本進(jìn)行安裝

root@linuxidc:~# apt-get install openjdk-7-jdk

3.設(shè)置環(huán)境變量

root@linuxidc:~# vi /etc/profile

在打開的profile文件中添加如下內(nèi)容

#set java environment
JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64
JRE_HOME=JAVAHOME/jreCLASSPATH=.:JAVA_HOME/lib/dt.jar:JAVAHOME/lib/tools.jar:JRE_HOME/lib
PATH=PATH:JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH

讓修改生效

root@linuxidc:~# source /etc/profile

4.驗(yàn)證(同上一方法)

二,、查看安裝路徑:

總結(jié)一下如何查找JDK安裝路徑的方法

   首先聲明,echo JAVAHOME經(jīng)/etc/profile,,JAVA_HOME配置錯(cuò)誤,輸出結(jié)果也是錯(cuò)誤的,。

  其次,,which java查詢到的是java的執(zhí)行路徑,不是安裝路徑?。,。ㄒ郧拔乙恢备悴磺宄?。,。面壁...)

  再者,whereis java 也不能查詢到安裝路徑,,它就羅列出一堆包含java的文件,,對(duì)查找安裝路徑一點(diǎn)用都沒(méi)有!??!

最后,開始高潮部分:


如此尋找才能到達(dá)目的,,100%,!

另附上/etc/profile配置詳細(xì)格式,

然后,,source /etc/profile 使之立即生效,。

javac: Command not found的解決辦法:

在centos7的terminal中輸入Java -verison是沒(méi)問(wèn)題的,但是javac的話就會(huì)提示沒(méi)有此命令

百度了好久,,說(shuō)的很復(fù)雜,,照著做了,最后也沒(méi)有成功

后來(lái)在stackoverflow上看到了這個(gè)

 

84 down voteaccepted

You installed the Java Runtime Environment (JRE) only, which does not contain javac. For javac, you have to install theOpenJDK Development Environment. You can install java-devel or java-1.6.0-openjdk-devel, which both includejavac.

By the way: you can find out which package provides javac with a yum search, e.g.

su -c 'yum provides javac'

Another note: using yum and openjdk is only one possibility to install the JDK. Many people prefer Sun/Oracle's "original" SDK. See How to install Java SDK on CentOS? and links for alternatives.

 

大意就是我們用yum來(lái)裝原生的就行了

使用

yum install java-devel

就行了

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,,所有內(nèi)容均由用戶發(fā)布,,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購(gòu)買等信息,,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請(qǐng)點(diǎn)擊一鍵舉報(bào),。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多