用Oracle JavareplaceGIJ

我试图在我的服务器上运行Google的Closure Compiler(CentOS 6)。 我安装了它,但只有当我试图运行它时才会出现错误。

java.lang.NoSuchMethodError: method java.util.regex.Pattern.quote with signature (Ljava.lang.String;)Ljava.lang.String; was not found. (Closure::Error) at com.google.javascript.jscomp.RhinoErrorReporter.replacePlaceHolders(RhinoErrorReporter.java:68) at com.google.javascript.jscomp.RhinoErrorReporter.<init>(RhinoErrorReporter.java:74) at com.google.javascript.jscomp.RhinoErrorReporter.<init>(RhinoErrorReporter.java:32) at com.google.javascript.jscomp.RhinoErrorReporter$OldRhinoErrorReporter.<init>(RhinoErrorReporter.java:143) at com.google.javascript.jscomp.RhinoErrorReporter$OldRhinoErrorReporter.<init>(RhinoErrorReporter.java:139) at com.google.javascript.jscomp.RhinoErrorReporter.forOldRhino(RhinoErrorReporter.java:108) at com.google.javascript.jscomp.Compiler.<init>(Compiler.java:151) at com.google.javascript.jscomp.CommandLineRunner.createCompiler(CommandLineRunner.java:755) at com.google.javascript.jscomp.AbstractCommandLineRunner.doRun(AbstractCommandLineRunner.java:693) at com.google.javascript.jscomp.AbstractCommandLineRunner.run(AbstractCommandLineRunner.java:334) at com.google.javascript.jscomp.CommandLineRunner.main(CommandLineRunner.java:871) 

看来我正在运行GIJ而不是Oracle的Java,所以我认为这可能会导致我的问题。 (或者,也许不是,如果不太可能,请随时纠正。)如何删除GIJ并在其中安装Oracle Java?

我做了显而易见的事情:从Oracle下载RPM,然后以root rpm -Uvh jre-7u5-linux-x64.rpm运行rpm -Uvh jre-7u5-linux-x64.rpm 。 冉java --version ,它仍然是GIJ。

我已经Google了半个小时了,但还没有find有用的东西。

运行alternatives --config java并selectOracle版本。

find你想要的软件包yum search java和/或yum provides java 。 在我的情况下,它是java-1.7.0-openjdk.x86_64 ,然后:

 yum install java-1.7.0-openjdk.x86_64 

yum remove不需要的版本