亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

How do I install Oracle Java JDK 7?

系統 1782 0

http://askubuntu.com/questions/55848/how-do-i-install-oracle-java-jdk-7

There is a similar question on how to install JRE 7.

Install the JDK

  • Download he 32bit or 64bit Linux "compressed binary file" - it has a ".tar.gz" file extension i.e. "[java-version]-i586.tar.gz" for 32bit and "[java-version]-x64.tar.gz" for 64bit
  • Uncompress it

    tar -xvf jdk-7u2-linux-i586.tar.gz (32bit)

    tar -xvf jdk-7u2-linux-x64.tar.gz (64bit)

JDK 7 package is extracted into ./jdk.1.7.0_02 directory. N.B. check carefully this folder name since Oracle seem to change this occasionally with each update.

  • Now move the JDK 7 directory to /usr/lib
      sudo mkdir -p /usr/lib/jvm

sudo mv ./jdk.1.7.0_02 /usr/lib/jvm/jdk1.7.0


    
  • Now run
      sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1

sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1

sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1


    
  • Correct the permissions of the executables:
      sudo chmod a+x /usr/bin/java 

sudo chmod a+x /usr/bin/javac 

sudo chmod a+x /usr/bin/javaws


    

N.B. remember - Java JDK has many more executables that you can similarly install as above. java , javac , javaws are probably the most frequently required.

This answer lists the other executables available.

  • Run
      sudo update-alternatives --config java


    

You will see output similar one below - choose the number of jdk1.7.0 - for example 3 in this list:

      
        $sudo update-alternatives --config java

There are 3 choices for the alternative java (providing /usr/bin/java).



Selection Path Priority Status

————————————————————

* 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode

1 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode

2 /usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode

3 /usr/lib/jvm/jdk1.7.0/jre/bin/java 3 manual mode



Press enter to keep the current choice[*], or type selection number: 3

update-alternatives: using /usr/lib/jvm/jdk1.7.0/jre/bin/java to provide /usr/bin/java (java) in manual mode.


      
    

Check the version of you new JDK 7 installation:

java -version

      
        java version “1.7.0”

Java(TM) SE Runtime Environment (build 1.7.0-b147)

Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode) 


      
    

Repeat the above for:

      
        sudo update-alternatives --config javac

sudo update-alternatives --config javaws


      
    

Enable mozilla firefox plugin:

      
        32 bit:

ln -s /usr/lib/jvm/jdk1.7.0/jre/lib/i386/libnpjp2.so ~/.mozilla/plugins/



64 bit:

ln -s /usr/lib/jvm/jdk1.7.0/jre/lib/amd64/libnpjp2.so ~/.mozilla/plugins/


      
    

N.B. you can link the plugin ( libnpjp2.so ) to /usr/lib/firefox/plugins/ for a system wide installation

Depending on your configuration, you might need to update the apparmor profile for firefox (or other browsers) in /etc/apparmor.d/abstractions/ubuntu-browsers.d/java

      
        # Replace the two lines:

#  /usr/lib/jvm/java-*-sun-1.*/jre/bin/java{,_vm} cx -> browser_java,

#  /usr/lib/jvm/java-*-sun-1.*/jre/lib/*/libnp*.so cx -> browser_java,

# with those (or adapt to your new jdk folder name)

/usr/lib/jvm/jdk*/jre/bin/java{,_vm} cx -> browser_java,

/usr/lib/jvm/jdk*/jre/lib/*/libnp*.so cx -> browser_java,


      
    

Then restart apparmor:

      
        sudo /etc/init.d/apparmor restart


      
    

Confirm that the JRE has been successful by using the official oracle website .

For Java 6:

If you're on a fresh installation of Ubuntu with no previous Java installations, this script automates the process outlined above if you don't want to type all that into a console. Remember, you still need to download Java from Oracle's website -- Oracle's links are not wget friendly.

Before using this make sure that this script is in the same directory as the .tar.gz file extension that you downloaded and there are no files that start with jdk-7 in the same folder -- if there are, please move them out of the folder temporarily. Remember to make the script executable, either by doing chmod +x <script's directory> or right clicking the document, pressing properties, going to the Permissions tab, and checking "Allow executing file as a program."

      
        #!/bin/sh



tar -xvf jdk-7*

sudo mkdir /usr/lib/jvm

sudo mv ./jdk1.7* /usr/lib/jvm/jdk1.7.0

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1

sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1

sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1

sudo chmod a+x /usr/bin/java

sudo chmod a+x /usr/bin/javac

sudo chmod a+x /usr/bin/javaws


      
    

If you want to install the plugin for Firefox then add this to the end of the script

      
        mkdir ~/.mozilla/plugins

ln -s /usr/lib/jvm/jdk1.7.0/jre/lib/amd64/libnpjp2.so ~/.mozilla/plugins/

sudo /etc/init.d/apparmor restart


      
    

Confirm if Java has been properly installed.

      
        java -version


      
    

Confirm that the JRE Mozilla plugin has been successful by using the official oracle website .

How do I install Oracle Java JDK 7?


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 伊人精品视频一区二区三区 | 深夜影院老司机69影院 | 一本本久综合久久爱 | 国产免费午夜a无码v视频 | h片网站在线观看 | 欧美在线观看a | 久久草在线视频播放 | 中文字幕视频一区 | videos欧美丰满肥婆 | 国产一区二区三区精品视频 | 中文字幕久久网 | 欧美一级毛片片免费孕妇 | 写真福利 第 页 在线视频 | 中文字幕在线最新在线不卡 | 天天舔天天干天天操 | 久草视频国产 | 国产精品免费大片 | jizz成熟丰满老女人 | 国产精品福利尤物youwu | 青娱乐91在线 | 四虎影城| 99在线观看视频免费精品9 | 超级97碰碰碰碰久久久久最新 | 成人国产精品视频 | 理论在线视频 | 欧美日韩亚洲第一页 | 国产成人久久精品二区三区牛 | 亚洲国产婷婷俺也色综合 | 欧美成人午夜视频免看 | 俄罗斯一级毛片免费视频 | 国产精品视频久久 | 色综合久久夜色精品国产 | 欧美一级免费大片 | 97在线观看免费观看高清 | 综合久久久久综合 | 亚洲欧美日韩综合 | 四虎永久免费在线观看 | 999精品在线 | 国产精品99久久久久久夜夜嗨 | 四虎国产永久在线精品免费观看 | 狠狠色噜噜狠狠狠狠网站视频 |