Install the JDK with CentOS today and find that when the installation is complete, enter the Java command to verify if the installation is successful.
Usage:gij [OPTION] ... CLASS [ARGS] ...
To invoke Class.main, or
Gij-jar [OPTION] ... Jarfile [ARGS] ...
To execute a JAR file
Try ' gij--help ' for more information.
Feel very strange, how to appear gij, in the online search error occurred because the Linux system is not the default point to the JDK version of the installation, so, to view the next
[email protected] ~]# which Java
/usr/bin/java
[Email protected] ~]# ls/usr/bin/java-l
lrwxrwxrwx. 1 root root 22 September 11:37/usr/bin/java-/etc/alternatives/java
[Email protected] ~]# Ll/etc/alternatives/java
lrwxrwxrwx. 1 root root 35 September 11:37/etc/alternatives/java-/usr/lib/jvm/jre-1.5.0-gcj/bin/java
[Email protected] ~]# java-version
Java Version "1.5.0"
Gij (GNU libgcj) version 4.4.7 20120313 (Red Hat 4.4.7-3)
Copyright (C) Free Software Foundation, Inc.
This was free software; See the source for copying conditions. There is NO
Warranty Not even to merchantability or FITNESS for A particular PURPOSE.
OK, we see that the red font does point to the JDK I just installed myself, and the index needs to be introduced using the alternatives tool to modify:
[Email protected] ~]# Alternatives--install/usr/bin/java Java/usr/java/jdk1.7.0_25/bin/java 300
Once again, enter the Java-version command to verify that the discovery remains unchanged, OK, and a step important operation:
[Email protected] ~]# Alternatives--config java
A total of 2 programs provide "Java".
Select command
-----------------------------------------------
*+ 1/usr/lib/jvm/jre-1.5.0-gcj/bin/java
2/usr/java/jdk1.7.0_25/bin/java
Press Enter to save the current selection [+], or type the selection number: 2
OK, all the changes have been completed, let's enter the Java command, see the results we want, problem solving.
Reboot the system and reconfigure if not yet. Directory is/etc/profile
This article is from "Ghost" blog, please make sure to keep this source http://fangwei009.blog.51cto.com/5234706/1673279
The Java version is incorrect after installing Java on CentOS