首页 > 系统相关 >Ubuntu 12.04 – install sun jdk 6-7

Ubuntu 12.04 – install sun jdk 6-7

时间:2023-03-28 14:04:53浏览次数:56  
标签:bin java lib jdk sun sudo 12.04 usr jvm


Ubuntu GNU/Linux 12.04 LTS (Precise Pangolin) released. I wanted to manually install the Sun JDK 6 and 7 on Ubuntu.

Updated for Ubuntu GNU/Linux 13.04 (Raring Ringtail).

Updated for Ubuntu GNU/Linux 12.10 (Quantal Quetzal).

Installing Sun JDK 6 on Ubuntu 12.04 / 12.10 / 13.04:

  • Download the sun jdk 6 bin from here.
  • Make the bin file executeable:
chmod +x jdk-6u32-linux-x64.bin
  • Extract the bin file:
./jdk-6u32-linux-x64.bin
  • For Ubuntu 13.04: There is no longer a jvm folder in /usr/lib, therefore create jvm folder
sudo mkdir /usr/lib/jvm
  • Move extracted folder to this location:
sudo mv jdk1.6.0_38 /usr/lib/jvm/jdk1.6.0_38
  • Install new java source in system:
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_38/bin/javac 1
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_38/bin/java 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_38/bin/javaws 1
  • Choose default java:
sudo update-alternatives --config javac
sudo update-alternatives --config java
sudo update-alternatives --config javaws
  • java version test:
java -version
  • Verify the symlinks all point to the new java location:
ls -la /etc/alternatives/java*
  • Enable Java plugin for Mozilla Firefox (even for Chrome)
#for 64-Bit jdk
sudo ln -s /usr/lib/jvm/jdk1.6.0_38/jre/lib/amd64/libnpjp2.so /usr/lib/mozilla/plugins
#for 32-Bit jdk
sudo ln -s /usr/lib/jvm/jdk1.6.0_38/jre/lib/i386/libnpjp2.so /usr/lib/mozilla/plugins

Installing Sun JDK 7 on Ubuntu 12.04 / 12.10 / 13.04:

  • Download the sun jdk 7 tar file from here
  • Extract the tar file:
tar -xvzf jdk-7u11-linux-x64.tar.gz
  • For Ubuntu 13.04: There is no longer a jvm folder in /usr/lib, therefore create jvm folder
sudo mkdir /usr/lib/jvm
  • Move extracted folder to this location:
sudo mv jdk1.7.0_11 /usr/lib/jvm/jdk1.7.0_11
  • Install new java source in system:
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_11/bin/javac 1
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_11/bin/java 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.7.0_11/bin/javaws 1
  • Choose default java:
sudo update-alternatives --config javac
sudo update-alternatives --config java
sudo update-alternatives --config javaws
  • java version test:
java -version
  • Verify the symlinks all point to the new java location:
ls -la /etc/alternatives/java*
  • Enable Java plugin for Mozilla Firefox (even for Chrome)
#for 64-Bit jdk
sudo ln -s /usr/lib/jvm/jdk1.7.0_11/jre/lib/amd64/libnpjp2.so /usr/lib/mozilla/plugins
#for 32-Bit jdk
sudo ln -s /usr/lib/jvm/jdk1.7.0_11/jre/lib/i386/libnpjp2.so /usr/lib/mozilla/plugins

Update: I have added Java Web Start configuration (Thanks Jack).

Update: I have added Java Plugin configuration for Mozilla Firefox even for Chrome (Thanks shetty).

Update: JAVA_HOME configuration: Some tools require JAVA_HOME variable. You can set JAVA_HOME in Ubuntu so simple: Edit the file .bashrc under your home directory and add the following lines: (if .bashrc is hidden, click in Nautilus Menu View > Show Hidden Files)

export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_11 or /usr/lib/jvm/jdk1.6.0_38
export PATH=$JAVA_HOME/bin:$PATH

or add this JAVA_HOME=/usr/lib/jvm/jdk1.7.0_11 in /etc/environment with sudo gedit /etc/environment

标签:bin,java,lib,jdk,sun,sudo,12.04,usr,jvm
From: https://blog.51cto.com/u_2650279/6154717

相关文章

  • ubuntu12.04安装QQ2012教程
    Ubuntu(乌班图)是基于DebianGNU/Linux,支持x86、amd64(即x64)和ppc架构,由全球化的专业开发团队(CanonicalLtd)打造的开源GNU/Linux操作系统,为桌面虚拟化提供支持平台。Ubuntu系统......
  • Linux下JDK和JMeter部署及使用
    一、在Linux下安装JDK并配置环境变量1、下载JDKJDK8下载地址:https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html2、rz命令上传到服务器......
  • linux 删除rpm安装的jdk,修改软连接
    由于rpm安装的java使得maven读取jdk环境变量出错NB:JAVA_HOMEshouldpointtoaJDKnotaJRE。弄了半天无果,索性删除所有jdk文件重新安装 #查看Java版本java-ve......
  • azul zulu OpenJDK 17 下载安装及配置环境变量
    2023/03/26,OpenJDK17.0.6,AzulZulu17.40.19摘要:azulzuluOpenJDK17下载安装及配置环境变量OpenJDK下载与安装下载在azul官网选择对应的jdk版本安装将下......
  • netbeans 在MAC OS X Mavericks +JDK 7 不能代码补全解决方法
     今天试用下MACOSXMavericks,感觉不错。但是发现netbeans运行不正常,选项里面代码补全、格式等选项卡均显示不全。也没法用mac+\补全 MACOSXMavericks使用JDK为JDK......
  • JDK1.8新特性
    JDK1.8新特性1.Java81.1生态Lambda表达式函数式接口方法引用/构造器引用StreamAPI接口中的默认方法/静态方法新时间日期API其他新特性1.2新特性......
  • Linux安装JDK1.8并配置环境变量
    @目录一、下载JDK安装包二、安装JDK三、配置环境变量四、验证JDK是否安装成功Hello,大家好!今天分享Linux安装配置JDK1.8教程,本教程是学长在项目上线时撰写的,经过生产环境......
  • Centos8安装JDK
    官网下载页:https://www.oracle.com/java/technologies/downloads/选择自己需要的JDK版本进行下载即可一、下载上传https://docs.oracle.com/javase/8/docs/technotes/guide......
  • JDK11搭建rocketmq
    环境要求JDK11.0.54G+free可使用wget命令下载、解压缩并安装wgethttps://archive.apache.org/dist/rocketmq/4.5.1/rocketmq-all-4.5.1-bin-release.zip放在/usr......
  • ubuntu18.04离线 安装jdk8环境
    Jdkoracle官方下载地址:https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html解压tar-zxvfjdk-8u152-linux-x64.tar.gz习惯上会......