Uninstalling Java 6 to replace with Java 8 [duplicate]

Every single time I try to install the Oracle Java Runtime Environment... I keep being stuck with Apple's Java 6. I have no idea how Apple's Java 6 ended up on my computer in the first place.

I keep putting "java -version" into the terminal and it comes out telling me I'm still running 6...

How do I remove Java 6? All I want to do is manage to run a Minecraft server, but it demands Java 8.

(I'm running Mac OS X Yosemite, in case that is relevant, because I can't find any up-to-date tutorials on how to do this)

Thanks in advance.


If you want to remove Java 6... From How to properly uninstall Java 6 on OSX?, do the following:

Remove the "system" JVM installed and maintained by Software Update

% sudo rm -rf /System/Library/Java/JavaVirtualMachines/1.6.0.jdk

Remove any Java Developer Previews

% sudo rm -rf /Library/Java/JavaVirtualMachines/1.6.0*.jdk

Do NOT remove any content in the JavaVM.framework. Those items are required by Java 7, 8, 9+ as well as Java SE 6. No modern version of OS X has a Java JDK inside there anyway.

Then to have Java 8 run from the Terminal when using java -version you need to install the JDK not JRE.

Note: I've tested the instructions here under OS X 10,10.3 and it works however maybe you had installed Java 6 for use by some application that needed it, as an example I installed Apples Java 6 to run muCommander however it will run under Java 8 too.


Try installing Java Development Kit (JDK). I did and Terminal showed RE was using Java 8.

I had to do the same thing with Java 7 as well.