After centos is installed, openjdk is used by default. We found that the image of the app verification code we developed is displayed incorrectly. We checked that the image interface is different from that of Sun JDK, we usually use Sun JDK for development in windows. Therefore, we must replace Sun JDK. Generally, we may need to delete open JDK. I checked it online and found a new method, use alternatives to convert the Java version. The specific method is as follows:
First, add the newly installed JDK to alternatives:
[Root @ djn-laptop sbin] #./alternatives -- install/usr/bin/Java/usr/share/jdk1.6.0 _ 02/bin/Java 300
[Root @ djn-laptop sbin] #./alternatives -- install/usr/bin/javac/usr/share/jdk1.6.0 _ 02/bin/javac 300
/Usr/share/jdk1.6.0 _ 02/bin/Java is the Sun JDK directory we installed. It depends on the directory you installed.
Then, use the -- display option to view the available JDK of the current system:
[Root @ djn-laptop sbin] #./alternatives -- display Java
Then you can use the -- config parameter to select the JDK you want to use:
[Root @ djn-laptop sbin] #./alternatives -- config Java
After using this command, the JDK list is displayed,
* 1/usr/lib/JVM/java-1.4.2-gcj/bin/javac
+ 2/usr/share/jdk1.6.0 _ 02/bin/javac
Press 1 or 2 to select the JDK you want to use. After switching is complete
Use Java-version to view the specific version