发现一个监控cpu和内存硬盘的小软件,但是打开老是没报错,而且网上资料很少、
启动一直报错,后来发现java版本不兼容
[root@mall ServerAgent]# netstat -anplt |grep 4444
[root@mall ServerAgent]# java -version
java version "1.5.0"
gij (GNU libgcj) version 4.4.7 20120313 (Red Hat 4.4.7-16)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@mall ServerAgent]# rpm -qa|grep java
gcc-java-4.4.7-16.el6.x86_64
java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64
java_cup-0.10k-5.el6.x86_64
删除自带的java在重新安装jdk1.7版本,完成没有报错
[root@mall ServerAgent]# yum -y remove gcc-java-4.4.7-16.el6.x86_64 Loaded plugins: fastestmirror Setting up Remove Process Resolving Dependencies --> Running transaction check ---> Package gcc-java.x86_64 0:4.4.7-16.el6 will be erased --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================= Package Arch Version Repository Size ============================================================================================================= Removing: gcc-java x86_64 4.4.7-16.el6 @base 9.2 M Transaction Summary ============================================================================================================= Remove 1 Package(s) Installed size: 9.2 M Downloading Packages: Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Erasing : gcc-java-4.4.7-16.el6.x86_64 1/1 Verifying : gcc-java-4.4.7-16.el6.x86_64 1/1 Removed: gcc-java.x86_64 0:4.4.7-16.el6 Complete! [root@mall ServerAgent]# [root@mall ServerAgent]# rpm -qa|grep java java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64 java_cup-0.10k-5.el6.x86_64 [root@mall ServerAgent]# yum -y remove java_cup-0.10k-5.el6.x86_64 Loaded plugins: fastestmirror Setting up Remove Process Resolving Dependencies --> Running transaction check ---> Package java_cup.x86_64 1:0.10k-5.el6 will be erased --> Processing Dependency: java_cup >= 0.10 for package: sinjdoc-0.5-9.1.el6.x86_64 --> Running transaction check ---> Package sinjdoc.x86_64 0:0.5-9.1.el6 will be erased --> Processing Dependency: sinjdoc for package: java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64 --> Running transaction check ---> Package java-1.5.0-gcj.x86_64 0:1.5.0.0-29.1.el6 will be erased --> Processing Dependency: java-gcj-compat for package: 1:ecj-3.4.2-6.el6.x86_64 --> Processing Dependency: java-gcj-compat for package: 1:ecj-3.4.2-6.el6.x86_64 --> Running transaction check ---> Package ecj.x86_64 1:3.4.2-6.el6 will be erased --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================= Package Arch Version Repository Size ============================================================================================================= Removing: java_cup x86_64 1:0.10k-5.el6 @base 544 k Removing for dependencies: ecj x86_64 1:3.4.2-6.el6 @base 7.3 M java-1.5.0-gcj x86_64 1.5.0.0-29.1.el6 @base 140 k sinjdoc x86_64 0.5-9.1.el6 @base 2.3 M Transaction Summary ============================================================================================================= Remove 4 Package(s) Installed size: 10 M Downloading Packages: Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Erasing : 1:ecj-3.4.2-6.el6.x86_64 1/4 Erasing : sinjdoc-0.5-9.1.el6.x86_64 2/4 Erasing : 1:java_cup-0.10k-5.el6.x86_64 3/4 Erasing : java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64 4/4 Verifying : 1:java_cup-0.10k-5.el6.x86_64 1/4 Verifying : 1:ecj-3.4.2-6.el6.x86_64 2/4 Verifying : sinjdoc-0.5-9.1.el6.x86_64 3/4 Verifying : java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64 4/4 Removed: java_cup.x86_64 1:0.10k-5.el6 Dependency Removed: ecj.x86_64 1:3.4.2-6.el6 java-1.5.0-gcj.x86_64 0:1.5.0.0-29.1.el6 sinjdoc.x86_64 0:0.5-9.1.el6 Complete! [root@mall ServerAgent]# rpm -qa|grep java [root@mall ServerAgent]# java -version -bash: /usr/bin/java: 没有那个文件或目录
[root@mall bin]# cd /usr/bin/
[root@mall bin]# ln -s -f /usr/local/jdk/bin/j
jar javafxpackager jcmd jinfo jrunscript jvisualvm
jarsigner javah jconsole jmap jsadebugd
java javap jcontrol jmc jstack
javac java-rmi.cgi jdb jmc.ini jstat
javadoc javaws jhat jps jstatd
[root@mall bin]# ln -s -f /usr/local/jdk/bin/javac
[root@mall bin]# ln -s -f /usr/local/jdk/bin/java
[root@mall bin]# ln -s -f /usr/local/jdk/jre/bin/java
[root@mall bin]# ln -s -f /usr/local/jdk/jre/bin/javac
[root@mall bin]# java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
完成后再次开启服务
[root@mall local]# cd ServerAgent
[root@mall ServerAgent]# ls
CMDRunner.jar lib LICENSE ServerAgent.jar ServerAgent.zip startAgent.bat startAgent.sh
[root@mall ServerAgent]# ./startAgent.sh
INFO 2015-12-23 11:04:35.055 [kg.apc.p] (): Binding UDP to 4444
INFO 2015-12-23 11:04:36.054 [kg.apc.p] (): Binding TCP to 4444
INFO 2015-12-23 11:04:36.059 [kg.apc.p] (): JP@GC Agent v2.2.0 started
INFO 2015-12-23 11:05:03.778 [kg.apc.p] (): Accepting new TCP connection
INFO 2015-12-23 11:05:03.795 [kg.apc.p] (): Yep, we received the 'test' command
INFO 2015-12-23 11:05:03.797 [kg.apc.p] (): Starting measures: cpu:
正常启动完成