ubuntu下的jdk进行升级,在ubuntu上安装jdk8-“无法找到软件包”更新无法解决

I've been trying to install the jdk on my ubuntu after downloading it.

first I've used: sudo apt-get update

then: sudo apt-get install jdk* (because I didn't want to write the whole long name).

it didn't work- printed the message in the title.

I thought the problem might me with the directory I'm executing from (I've executed it from the Downloads directory in which the file exists), so I've tried executing the same command (sudo apt-get install jdk*) from the home directory (root directory). Then it worked.. the whole installation took about 5 minutes and it looked like it was installing a lot of things I didn't ask for.

I wasn't sure it installed what I needed to I went back to the Downloads directory where the jdk8 package was located and like the first time ran the command from there. the same message as before... couldn't locate the package.

What have I done wrong ? Obviously it wasn't installed because when I've checked the version of java (java -version) it didn't show jdk8 was installed.

Thank you if you've taken the time to read to this point :)

解决方案

Command Line option - Ubuntu

sudo apt-get install python-software-properties

sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

Then in terminal

sudo apt-get install oracle-java8-installer

When there are multiple Java installations on your System, the Java version to use as default can be chosen. To do this, execute the following command.

sudo update-alternatives --config java

sudo update-alternatives --config javac

sudo update-alternatives --config javaws

Edit - Manual Java Installation

Download oracle jdk

http://www.oracle.com/technetwork/java/javase/downloads/index.html

Extract zip into desired folder

e.g /usr/local/ after extract /usr/local/jdk1.8.0_65

Setup

sudo update-alternatives --install /usr/bin/java java /usr/local/jdk1.8.0_65/bin/java 1

sudo update-alternatives --install /usr/bin/javac javac /usr/local/jdk1.8.0_65/bin/javac 1

sudo update-alternatives --install /usr/bin/javaws javaws /usr/local/jdk1.8.0_65/bin/javaws 1

sudo update-alternatives --set java /usr/local/jdk1.8.0_65/bin/java

sudo update-alternatives --set javac /usr/local/jdk1.8.0_65/bin/javac

sudo update-alternatives --set javaws /usr/local/jdk1.8.0_65/bin/javaws

Edit /etc/environment set JAVA_HOME path for external applications like Eclipse and Idea

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值