CentOS 7 configure Java language development environment

CentOS 7 configure Java language development environment#

Initial setting reference: http://blog.csdn.net/wh211212/article/details/52923673

Install JDK8

Install Java SE Development Kit 8 (JDK8) and build the Java environment

[ root@linuxprobe ~]# curl -L "http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.rpm"-H "Cookie: oraclelicense=accept-securebackup-cookie"-H "Connection: keep-alive"-O
# Use yum or rpm to install jdk (here a yum is an example)
[ root@linuxprobe ~]# yum localinstall jdk-8u121-linux-x64.rpm -y
Loaded plugins: fastestmirror
Examining jdk-8u121-linux-x64.rpm:2000:jdk1.8.0_121-1.8.0_121-fcs.x86_64
Marking jdk-8u121-linux-x64.rpm to be installed
Resolving Dependencies
- - > Running transaction check
- - - > Package jdk1.8.0_121.x86_64 2000:1.8.0_121-fcs will be installed
- - > Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================================================================================================
 Package                                                         Arch                                                      Version                                                               Repository                                                               Size
===============================================================================================================================================================================================================================================================================
Installing:
 jdk1.8.0_121                                                    x86_64                                                    2000:1.8.0_121-fcs                                                    /jdk-8u121-linux-x64                                                    263 M

Transaction Summary
===============================================================================================================================================================================================================================================================================
Install  1 Package

Total size:263 M
Installed size:263 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
 Installing :2000:jdk1.8.0_121-1.8.0_121-fcs.x86_64                                                                                                                                                                                                                      1/1
Unpacking JAR files...
 tools.jar...
 plugin.jar...
 javaws.jar...
 deploy.jar...
 rt.jar...
 jsse.jar...
 charsets.jar...
 localedata.jar...
 Verifying  :2000:jdk1.8.0_121-1.8.0_121-fcs.x86_64                                                                                                                                                                                                                      1/1

Installed:
 jdk1.8.0_121.x86_64 2000:1.8.0_121-fcs

Complete![root@linuxprobe ~]# java -version
java version "1.8.0_121"Java(TM) SE Runtime Environment(build 1.8.0_121-b13)
Java HotSpot(TM)64-Bit Server VM(build 25.121-b13, mixed mode)
# Set jdk environment variables
[ root@linuxprobe ~]# vi /etc/profile
# add follows to the end
export JAVA_HOME=/usr/java/defaultexport PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
[ root@linuxprobe ~]# source /etc/profile

Reference link: http://blog.csdn.net/gsls200808/article/details/52336745 (use curl and wget to download the latest version of JDK)

# In java-1.8.0-openjdk as an example
[ root@linuxprobe ~]# yum install java-1.8.0-openjdk -y
[ root@linuxprobe ~]# alternatives --config java

There are 2 programs which provide 'java'.

 Selection    Command
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 /usr/java/jdk1.8.0_121/jre/bin/java
*+2   java-1.8.0-openjdk.x86_64(/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/jre/bin/java)
# Choose the latest version of Oracle JDK installed through yum
Enter to keep the current selection[+], or type selection number:1
[ root@linuxprobe ~]# vi day.java
 import java.util.Calendar;classday{publicstaticvoidmain(String[] args){
  Calendar cal = Calendar.getInstance();
  int year = cal.get(Calendar.YEAR);
  int month = cal.get(Calendar.MONTH)+1;
  int day = cal.get(Calendar.DATE);
  int hour = cal.get(Calendar.HOUR_OF_DAY);
  int minute = cal.get(Calendar.MINUTE);
  System.out.println(year +"/"+ month +"/"+ day +" "+ hour +":"+ minute);}}

# compile
[ root@linuxprobe ~]# javac day.java 
[ root@linuxprobe ~]# java day
2017 /4/1221:49

Recommended Posts

CentOS 7 configure Java language development environment
CentOS 7 configure Ruby language development environment
CentOS 7 configure php language development environment
CentOS 7 configure Python language development environment
Configure Java development environment in Ubuntu20.04 LTS
Ubuntu18.10 configure Java environment
Centos7 configure nodejs environment
Configure CentOS7 GPU environment
CentOS 7 install JAVA environment (JDK 1.8)
CentOS 7.2 deploy Node.js development environment
Build a basic environment for Java development under Centos7
Configure python3 environment on centos7 and
Centos7.5 configuration java environment installation tomcat explanation
CentOS 7 install Java 1.8
Centos7 configure JDK
CentOS 7 install Java 1.8
01 CentOS 7.6 switch system language
Install Java on Centos 7
CentOS6.7 build LNMP environment
Configure Ocserv on CentOS 6
Hadoop environment construction (centos7)
Ubuntu configuration development environment
Centos7.6 build LNMP environment
Embedded Linux development environment to build and configure Ubuntu
lamp (centos7) installation lamp environment
Ubuntu development environment configuration
Centos6.9 install npm environment
Configure lamp under centos6.8
Centos7 configure IP address
CentOS Python Java installations
CentOS 7 build LNMP environment
[CentOS environment deployment] Java7/Java8 deployment under CentOS
Build docker environment under Centos6.5
SkyWalking study notes (CentOS environment)
Centos7 set up GitBook environment
CentOS install nginx+tomcat+java+mysql operating environment
CentOS6.5 install Java 8 and Tomcat8
Configure static IP under CentOS 7
Centos6.5 install and configure mongodb
Centos configure multiple virtual IP
Configure swap space on CentOS7
Install Java JDK8 under CentOS6
CentOS6.5 install Java 8 and Tomcat8
CentOS6.5 install Java 8 and Tomcat8
Centos6 set up GitBook environment
CentOS environment installation of Docker
ubuntu build python development environment
ubuntu builds common development environment
Centos7 deploys python3 virtual environment
Centos7.4 environment installation lamp-php7.0 tutorial
Centos configure multiple virtual IP