Java – Replace GIJ with Oracle Java

centos6java

I'm trying to run Google's Closure Compiler on my server (CentOS 6). I installed it, but only got errors when I tried to run it.

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)

It seems I'm running GIJ instead of Oracle's Java, so I think that could be causing my problems. (Or maybe not, feel free to correct me if this isn't likely.) How do I remove GIJ and install Oracle Java in it's stead?

I did the obvious: Downloaded the RPM from Oracle, and ran rpm -Uvh jre-7u5-linux-x64.rpm as root. Ran java --version and it's still GIJ.

I've been Google for half an hour now, but haven't found anything helpful.

Best Answer

Run alternatives --config java and select the Oracle version.