In general, we will install Java into the/usr/local directory or the/opt directory. This assumes that the Java installation package has been unzipped under/OPT, the specific directory is:/opt/java8/java1.8.0_25 directory.
Let's configure the Java environment variable and open /etc/profile after the file:
$ export java_home=/opt/java8/java1.8.0_25$ export path= $JAVA _home/bin: $JAVA _home/jre/bin: $PATH $ export classpath=.: $JAVA _home/lib: $JAVA _home/jre/lib
Note: The environment variable must not take a space , otherwise it will be an error.
After the update completes the profile, let's take one more line of the following statement:
$ source/etc/profile
Final execution:
$ java-version
Look at the Java installation configuration is not successful!! The modified configuration file will eventually take effect or log off to log back in or restart the computer !!
Configuring Java environment variables under Linux