Set OpenJDK environment variables in CentOS
When I installed phpstorm today, I was prompted that I could not find JAVA_HOME, So I remembered that I had not installed JDK! Try openJDK on linux!
Centos comes with OpenJDK's Runtime (JRE). In "Add/Delete", we can find JDK (OpenJDKDevelopmentEnvironment) and install it.
After the installation, there are no system variables such as java_home, and you need to add them yourself.
However, the openJDK installation directory is different from the common SunJDK storage directory.
(Many people abandon openJDK When configuring environment variables)
I want to die when I flip through the directory ...... (Because centos does not open a directory, it is a new window), online search, Chinese Web page results are really not! I finally found a solution on the openJDK official forum!
After openJDK is installed, the directory is located in/usr/lib/jvm, including jre and jdk.
You can see "bin" in the "java-1.6.0-openjdk-1.6.0.0" Directory (if not, it means that your openJDKforJDK has not been installed, please go back to the second sentence on this page, carefully study !) You can find the javac file in the bin, indicating that this is JDK!
In this case, you only need to open the environment variable file suvi/etc/profile in the terminal (Save the command and Press ESC, then enter ": w" to save the file, and then ": q" to exit vi) enter the corresponding directory:
ExportJAVA_HOME =/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.
ExportCLASSPATH =.: $ JAVA_HOME/jre/lib/rt. jar: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar
ExportPATH = $ PATH: $ JAVA_HOME/bin
In this way, we have set the JDK and it will take effect after entering source/etc/profile.
In this case, try to enter the command "javac" to check out ~?