When installing NetBeans in Centos for development, you will be prompted to install the java jdk, especially the latest version of NetBeans requires jdk 1.7 and later.
1. Download the installation file
Download jdk-7u72-linux-x64.rpm files on sun official website.
2. Installation
[Sun @ localhost Downloads] $ sudo cp jdk-7u72-linux-x64.rpm/usr/local/
[Sun @ localhost local] $ sudo rpm-ivh jdk-7u72-linux-x64.rpm
3. Configure the environment
[Sun @ localhost Downloads] $ sudo vim/etc/profile
Enter at the end of the file
JAVA_HOME =/usr/java/jdk1.7.0 _ 72
JRE_HOME =/usr/java/jdk1.7.0 _ 72/jre
PATH = $ PATH: $ JAVA_HOME/bin: $ JRE_HOME/bin
CLASSPATH =: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar: $ JRE_HOME/lib
Export JAVA_HOME JRE_HOME PATH CLASSPATH
4. Make the modification take effect immediately. Check the jdk Version.
[Sun @ localhost local] $ source/etc/profile
[Sun @ localhost local] $ java-version
Java version "1.7.0 _ 45"
OpenJDK Runtime Environment (rhel-2.4.3.3.el6-x86_64 u45-b15)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)