In recent times, when configuring the JDK on the CENOS7, I found myself in a pit (and too little of my own knowledge).
Go to the official website to download JDK 7, then unzip, put in my own definition of a directory, usually opt or data inside. The preparation is complete and is now configured:
In general, I do not have to root directly to manage my computer, with a regular administrator account, so there will be some sudo situation do not take it amiss:
First need CP under profile, otherwise if the configuration is wrong, you can also restore:
Edit/etc/profile File
Vi/etc/profile
Add at end of/etc/profile file
java_home=/opt/java/jdk1.7.0_79
Classpath=.: $JAVA _home/jre/lib/rt.jar: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Path= $PATH: $JAVA _home/bin
Export Java_home CLASSPATH PATH
Use the Source/etc/profile command to reload the/etc/profile file so that the modified content takes effect in the current shell window. (permanently in effect, reboot the system or log off the user)
There may be hints that there are no permissions or insufficient permissions, in which case a chmod-r 755 can be faced inside the corresponding JDK directory jdk1.7.0_79 so you can
The above is true, but at first I followed the semicolon as the delimiter in win and Ubnutu, but it is worth noting here that the colon is used for Sima.
Reference connection: http://doc.okbase.net/cennac/archive/126829.html