ubuntu vps 安装java
Introduction
Java is a programming technology originally developed by Sun Microsystems and later acquired by Oracle. Oracle Java is a proprietary implementation for Java that is free to download and use for commercial use, but not to redistribute, therefore it is not included in a officially maintained repository.
There are many reasons why you would want to install Oracle Java over OpenJDK. In this tutorial, we will not discuss the differences between the above mentioned implementations.
Assumptions
This tutorial assumes that you have an account with DigitalOcean, as well as a Droplet running Debian 7 or Ubuntu 12.04 or above. You will need root privileges (via sudo) to complete the tutorial.
You will need to know whether you are running a 32 bit or a 64 bit OS:
uname -m
x86_64: 64 bit kernel
i686: 32 bit kernel
Downloading Oracle Java JDK
Using your web browser, go to the Oracle Java SE (Standard Edition) website and decide which version you want to install:
JDK: Java Development Kit. Includes a complete JRE plus tools for developing, debugging, and monitoring Java applications.
Server JRE: Java Runtime Environment. For deploying Java applications on servers. Includes tools for JVM monitoring and tools commonly required for server applications.
In this tutorial we will be installing the JDK Java SE Development Kit 8 x64 bits. Accept the license and copy the download link into your clipboard. Remember to choose the right tar.gz (64 or 32 bits). Use wget to download the archive into your server:
wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz
Oracle does not allow downloads without accepting their license, therefore we needed to modify the header of our request. Alternatively, you can just download the compressed file using your browser and manually upload it using a SFTP/FTP client.
Always get the latest version from Oracle's website and modify the commands from this tutorial accordingly to your downloaded file.
Installing Oracle JDK
In this section, you will need sudo privileges:
sudo su
The /opt directory is reserved for all the software and add-on packages that are not part of the default installation. Create a directory for your JDK installation:
mkdir /opt/jdk
and extract java into the /opt/jdk directory:
tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk
Verify that the file has been extracted into the /opt/jdk directory.
ls /opt/jdk
Setting Oracle JDK as the default JVM
In our case, the java executable is located under /opt/jdk/jdk1.8.0_05/bin/java . To set it as the default JVM in your machine run:
update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_05/bin/java 100
and
update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_05/bin/javac 100
Verify your installation
Verify that java has been successfully configured by running:
update-alternatives --display java
and
update-alternatives --display javac
The output should look like this:
java - auto mode
link currently points to /opt/jdk/jdk1.8.0_05/bin/java
/opt/jdk/jdk1.8.0_05/bin/java - priority 100
Current 'best' version is '/opt/jdk/jdk1.8.0_05/bin/java'.
javac - auto mode
link currently points to /opt/jdk/jdk1.8.0_05/bin/javac
/opt/jdk/jdk1.8.0_05/bin/javac - priority 100
Current 'best' version is '/opt/jdk/jdk1.8.0_05/bin/javac'.
Another easy way to check your installation is:
java -version
The output should look like this:
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
ubuntu vps 安装java的更多相关文章
- ZH奶酪:如何在Ubuntu上安装Java/管理多个JAVA/设置JAVA_HOME
0.简介 Java的地位及重要性,大家都懂的,很多软件都依赖于jdk,在Ubuntu上安装Java的选择有很多,openJDK,Oracle Jdk... 1.安装默认 JRE/JDK(可选) 这是最 ...
- Ubuntu 14 安装Java(JRE、JDK)
JRE vs OpenJDK vs Oracle JDK JRE(Java Runtime Environment),它是你运行一个基于Java语言应用程序的所正常需要的环境.如果你不是一个程序员的话 ...
- Ubuntu 14 安装Java(JRE、JDK)、Maven
JRE vs OpenJDK vs Oracle JDK JRE(Java Runtime Environment),它是你运行一个基于Java语言应用程序的所正常需要的环境.如果你不是一个程序员的话 ...
- 【Ubuntu】安装Java和Eclipse
1. 安装Java 1> sudo add-apt-repository ppa:webupd8team/java 2> sudo apt-get update 3> sudo ap ...
- ubuntu vps 安装 jdk
Introduction Java is a programming technology originally developed by Sun Microsystems and later acq ...
- ubuntu之安装java浏览器插件
最近搞什么openstack,在浏览器访问远程虚拟机的时候,需要浏览器有支持java.这个之前真没注意过呢, 通过自己的实践写点东西,方便一下你们搞: 1,首先去http://www.java.com ...
- ubuntu下安装java和eclipse
java安装 1 下载jdk http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html 2 ...
- ubuntu下安装 java环境
步骤1:下载jdk 我选择的jdk版本文件: jdk-8u201-linux-x64.tar 官网下载链接 步骤2:创建单独的目录 sudo mkdir /usr/local/java 步骤3:将下载 ...
- Ubuntu下安装java
1.首先到java.com下载最新版本的jdk.下面是jdk8的网址: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-dow ...
随机推荐
- BZOJ 1006 [HNOI2008] 神奇的国度(简单弦图的染色)
题目大意 K 国是一个热衷三角形的国度,连人的交往也只喜欢三角原则.他们认为三角关系:即 AB 相互认识,BC 相互认识,CA 相互认识,是简洁高效的.为了巩固三角关系,K 国禁止四边关系,五边关系等 ...
- Android SDK Manager无法显示可供下载的未安装SDK解决方案
FAQ: 问下的 我的ANDROID SDK MANAGER里原来下载了一些SDK,但是我现在想重新下载新的SDK,咋Packages列表没显示呢?该怎么办? Answer: 据说dl-ssl.goo ...
- C# 通过WebService方式 IIS发布网站 上传文件到服务器
应用场景:要将本地的文件 上传到服务器的虚拟机上 网络环境:公司局域网(如下图中第二种) 开发环境:VS2010 服务器环境:WinServer2008 虚拟机环境:WinServer2008 ...
- 如何交换两个等长整形数组使其数组和的差最小(C和java实现)
1. 问题描述: 有两个数组a,b,大小都为n,数组元素的值任意整形数,无序: 要求:通过交换a,b中的元素,使[数组a元素的和]与[数组b元素的和]之间的差最小. 2. 求解思路: 当前数组a和数组 ...
- excel导入记录
use DangJianSELECT vale1, value2 into Table2 from Table1 select COUNT(*) from tmpdangyuan where 手机号 ...
- css知识
margin和padding是什么意思 margin外边距,padding内边距,外边距表示一个元素的边到相邻元素的距离,内边距表示元素之间的内容和元素边框的距离. font:12px/1.5 表示什 ...
- 价值100W的经验分享: 基于JSPatch的iOS应用线上Bug的即时修复方案,附源码.
限于iOS AppStore的审核机制,一些新的功能的添加或者bug的修复,想做些节日专属的活动等,几乎都是不太可能的.从已有的经验来看,也是有了一些比较常用的解决方案.本文先是会简单说明对比大部分方 ...
- 黑客入门之IP地址及常用命令
在网络上,只要利用IP地址就可以找到目标主机,因此,如果黑客想要攻击某个网络主机,就要先确定该目标主机的域名或IP地址. IP地址概述 所谓IP地址就是一种主机编址方式,给每个连接在Internet上 ...
- 【Win10】探索 Windows 10 10586 之 JumpList(跳转列表)
Windows 10 10586 出来了也挺久的了,应该大部分都从 10240 升级到这个版本了.在 10586 中,微软添加了 200 多个新的 API,具体 API 的变动,大家可以点击下面这个链 ...
- ADO.NET学习系列(四)---窗体版的登录小程序
1.需求分析:做一个登录的小程序,基于Winform的窗体小程序.基本要求:登录成功:弹框显示登录成功,登录失败就弹框显示失败. 扩展功能:登录次数超过3次,就”锁定“用户,提示登录错误次数过多,不能 ...