unbuntu java环境安装与设置(chenxl)

安装jre 
1) sudo apt-get install sun-java5-jre
安装jdk
2)
sudo apt-get install sun-java5-jdk
我的源如下:

deb http://cn.archive.ubuntu.com/ubuntu/ dapper main restricted
deb-src http://cn.archive.ubuntu.com/ubuntu/ dapper main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ dapper-updates main restricted
deb-src http://cn.archive.ubuntu.com/ubuntu/ dapper-updates main restricted

## Uncomment the following two lines to add software from the 'universe'
## repository.
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
# deb http://cn.archive.ubuntu.com/ubuntu/ dapper universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ dapper universe

## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://cn.archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu dapper-security main restricted
deb-src http://security.ubuntu.com/ubuntu dapper-security main restricted
# deb http://security.ubuntu.com/ubuntu dapper-security universe
# deb-src http://security.ubuntu.com/ubuntu dapper-security universe
# deb http://tonelli.sns.it/pub/mplayer/etch ./
# The Opera browser (packages)
#deb http://deb.opera.com/opera etch non-free
#deb ftp://ftp.nerim.net/debian-marillat/ stable main
# (00:24:00) AnThOnYhO: 这三个是w32codecs的源
#deb ftp://ftp.nerim.net/debian-marillat/ sarge main
#deb ftp://ftp.nerim.net/debian-marillat/ sid main
#deb ftp://ftp.nerim.net/debian-marillat/ etch main
#deb http://debian.cn99.com/ubuntu-cn dapper main

3)环境变量设置:
   sudo update-alternatives --config java
   选择 3 sun

4)测试:
    输入  java -version
  会出现java版本
  编写个helloworld程序
   public class HelloWorld{
    public static void main(String[] args){
        System.out.println("hello world!");
    }
}

编译:javac HelloWorld.java
执行:java HelloWorld
输出  : hello world !
恭喜你 !!!!安装成功
 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值