Install Java with yum on Centos:
$ yum install java-1.7.0-openjdk java-1.7.0-openjdk-devel
Install Java with yum on Debian:
su -
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
apt-get update
apt-get install oracle-java7-installer
exit
OR
#Download Java:
mkdir -p /usr/java/ cd /usr/java/ wget http://download.huangshiyang.com/jdk-7u67-linux-x64.gz tar -xzvf jdk-7u67-linux-x64.gz wget http://download.huangshiyang.com/jdk-8u111-linux-x64.tar.gz tar -xzvf jdk-8u111-linux-x64.tar.gz
#Export JAVA_HOME & PATH:
vi /etc/profile
#Add the following lines at the end:
export JAVA_HOME=/usr/java/jdk1.7.0_67 export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$PATH:$JAVA_HOME/bin
#Enable config:
source /etc/profile
#Test
java -version java javac jps
一般情况下,我们都要将linux自带的OPENJDK卸载掉,然后安装SUN的JDK。
首先查看Linux自带的JDK是否已安装。
输入如下命令,查看已经安装的JAVA版本信息。
- java -version
输入如下命令,查看JDK的信息。
- rpm -qa|grep java
如下图所示。
卸载已经安装的JAVA,如下图所示。
卸载完成,如下图所示。
卸载另外一个,如下图所示。
卸载完成,如下图所示。
第二步,安装SUN的JDK。
官网:http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
在/usr下建立一个java目录,以备将java程序安装在此目录下,输入如下命令:
- mkdir /usr/java
把下载好的安装文件拷贝到原系统的共享文件夹share中,通过命令查看文件:
- cd /mnt/share
- ls -a
将文件复制到/usr/java目录下,输入如下命令:
- cp *.gz /usr/java
查看/usr/java目录,输入如下命令:
- cd /usr/java
- ls -a
如下图所示。
解压文件,输入如下命令:
- tar -xzvf jdk-7u13-linux-x64.gz
解压后,在/usr/java目录下就会生成一个新的目录jdk1.7.0_13,该目录下存放的是解压后的文件。
为了以后设置方便,我们该生成的目录jdk1.7.0_13改名为jdk,输入如下命令:
- mv jdk1.7.0_13 jdk
如下图所示。
或者,如果你下载的文件是rpm 格式的话,在上面用tar命令处,替换为下列命令来安装,其他步骤不变。
- rpm -ivh jdk-7u13-linux-x64.rpm
最后进行环境变量的设置。
输入如下命令,进入配置文件。
- vi /etc/profile
如下图所示。
进入配置文件,如下图所示,将红色框中的第一行删除,换为下面三行配置信息。
让环境变量生效。
执行配置文件,令其立刻生效,输入如下命令:
- source /etc/profile
验证是否安装成功,输入如下命令:
- Java -version
如下图所示,表示安装成功!
运行第一个JAVA程序。
新建一个HelloWorld.java文件,如下图所示。
编辑文件,如下图所示。
保存文件,编译并运行,如下图所示。
运行成功!
如果下载的是bin结尾的java文件,可以参考:http://blog.csdn.net/cezeffort/article/details/7605863
java下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
I’m really impressed with your writing skills as
well as with the layout on your blog. Is this a paid theme or did you modify it yourself?
Anyway keep up the nice quality writing, it is rare to see a
nice blog like this one nowadays.
Jamilly Nascimento comentou em 7 de dezembro de 2009 às 15:24. Oláá :D(sobre a make azul que eu pedi pra voce)Meus olhos sao castanhos, e so Branquinha..e cabelo meio loi;3Ro0rMuiiiiiito Obrigada 😀
My family members always say that I am wasting my time here
at web, except I know I am getting knowledge daily by reading
such pleasant articles or reviews.
At last, sonmeoe who comes to the heart of it all
Your blog can go viral, you need some initial traffic
only. How to get initial traffic??? Search in google for: nhuum’s seo
That is great that you asked for help. What a relief to get the first times out of the way because hoeplufly now it won't be so hard to do it again.You know, I am always here to babysit my favorite little guy!
I see, that your page needs fresh and unique articles.
I know it is hard to write articles manually everyday, but there is solution for this.
Just search in google for- servitu’s tricks
There are no words to describe how boaiodcus this is.
Muchos Gracias for your post.Really thank you! Keep writing.
Haha, shouldn’t you be charging for that kind of knedoewgl?!
I like the valuable information you provide in your articles. I’ll bookmark your weblog and check again here frequently. I’m quite sure I will learn plenty of new stuff right here! Best of luck for the next!
My favorite character in the whole series is Peeta, but since so many people love him I think I will talk about my second favorite character: Boggs! He is amazing to Katniss in Moiancgjky, warning her not to trust Coin, and telling her to get Snow. I feel like he is given so little credit, he has an important role in how it all plays out.
Alan, thank you for presenting at Club Ajax. You did a fine job with a rough crowd. I am excited to see Adobe coiibnruttng to the future of webkit, phonegap, and other open source projects.I would love to see you back at Club Ajax with new stuff in the future.Jeff.
That is to say 2012, their whole defense just visited the exact forefront with their accomplishment earlier this time of year. The very Kings brought the main NHL which has a small 2 . 05 goals-against-average and even finished driving the actual Demons with 26. two shots helped per game. These folks furthermore the absolute best staff within the addition in many property stats.
Step five: Fit performance specifications
Reading your site is big pleasure for me, it deserves to go viral, you need some initial traffic only.
If you want to know how to get it search for: blackhatworren’s strategies
And also, with regard to Trotz and his team, the main daunting reality is this specific: Anticipate many very same for Game some.