配置jdk




$ sudo apt-get install openjdk-7-jre

ubutun16.04 安装jdk错误:提示没有 candidate 或者 rescorces
http://askubuntu.com/questions/761127/ubuntu-16-04-and-openjdk-7  参考文章  

sudo add-apt-repository ppa:openjdk-r/ppa  
sudo apt-get update   
sudo apt-get install openjdk-7-jdk  

/下面参考即可//

0. 使用env 发现编译android 需要的版本书java-7-openjdk-amd64/bin:

<pre name="code" class="plain">fuxuan@ubuntu:/usr/lib/jvm$ env
ANDROID_DEV_SCRIPTS=/home/fuxuan/WORKING_DIRECTORY/development/scripts:/home/fuxuan/WORKING_DIRECTORY/prebuilts/devtools/tools:/home/fuxuan/WORKING_DIRECTORY/external/selinux/prebuilts/bin
XDG_VTNR=7
XDG_SESSION_ID=c2
ANDROID_PRE_BUILD_PATHS=/usr/lib/jvm/<strong>java-7-openjdk-amd64/bin:</strong>


 

1. java se 7 下载地址

http://www.oracle.com/technetwork/cn/java/javase/downloads/jdk7-downloads-1880260.html

2. 将 java 7 安装到该目录 下面/usr/lib/jvm/

3. 配置环境变量 

打开/etc/profile(vim /etc/profile)
在最后面添加如下内容:
JAVA_HOME=/usr/lib/jvm/jdk1.7.0_40    // java 安装在哪个目录,这里的目录就配置在那里!!!!!

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

PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
4、source /etc/profile
5、验证是否安装成功:java -version
6. $  sudo apt-get install openjdk-7-jre
7.

Setting the "JAVA_HOME" environment variable

To set the JAVA_HOME environment variable, which is needed for some programs, first find out the path of your Java installation:

sudo update-alternatives --config java

It returns something like:

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

Selection    Path                                            Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-7-oracle/jre/bin/java          1062      auto mode
  1            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      manual mode
  2            /usr/lib/jvm/java-7-oracle/jre/bin/java          1062      manual mode

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

The path of the installation is for each:

  1. /usr/lib/jvm/java-7-oracle

  2. /usr/lib/jvm/java-6-openjdk-amd64

  3. /usr/lib/jvm/java-7-oracle

Copy the path from your preferred installation and then edit the file /etc/environment:

sudo nano /etc/environment

In this file, add the following line (replacing YOUR_PATH by the just copied path):

JAVA_HOME="YOUR_PATH"

That should be enough to set the environment variable. Now reload this file:

source /etc/environment

Test it by executing:

echo $JAVA_HOME

If it returns the just set path, the environment variable has been set successfully. If it doesn't, please make sure you followed all steps correctly.




$ sudo apt-get install openjdk-7-jre

ubutun16.04 安装jdk错误:提示没有 candidate 或者 rescorces
http://askubuntu.com/questions/761127/ubuntu-16-04-and-openjdk-7  参考文章  

sudo add-apt-repository ppa:openjdk-r/ppa  
sudo apt-get update   
sudo apt-get install openjdk-7-jdk  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值