How-to: Set Oracle Java as Default Runtime Environment
Desmond Leung updated April 7, 2015 at 1:59 PM
Questions Addressed
- How do I set the Oracle version of Java as the default runtime environment on my machine? How do I set the Oracle version of Java as the default runtime environment on my machine?
- Why does running the command "java -version" display the wrong version of Java? Why does running the command "java -version" display the wrong version of Java?
...
- Download and install the latest version of Java 7 or Java 8 from Oracle if you have not already done so. https://www.java.com/en/download/
- Open Terminal.app Terminal.app
- Type in the following command:
- java -version
- If the version number looks like 1.
- 7.X_XX
- OR
- 1.8.X_XX, then an Oracle version of Java is already set as the default runtime environment. Do not proceed to the next steps.
- If the version number does not does not look like 1.
- 7
- .X_XX OR
- 1.8.X_XX, then an Oracle version of Java is not set as the default runtime environment. Proceed to the next step.
- Type in the following two commands:
- sudo mv /usr/bin/java /usr/bin/java-1.6
- sudo ln -s '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java' /usr/bin/java
- Type in the following command:
- java -version
- It should now indicate that Java 7 or Java 8 is the default runtime environment.
- java -version java -version
- If the version number looks like 1. 1. 7 7 .X_XX .X_XX OR 1.8.X_XX 1.8.X_XX , then an Oracle version of Java is already set as the default runtime environment. Do not proceed to the next steps.
- If the version number does not does not look like 1. 1. 7 7 .X_XX .X_XX OR 1.8.X_XX 1.8.X_XX , then an Oracle version of Java is not set as the default runtime environment. Proceed to the next step.
...
- sudo mv /usr/bin/java /usr/bin/java-1.6 sudo mv /usr/bin/java /usr/bin/java-1.6
- sudo ln -s '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java' /usr/bin/java sudo ln -s '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java' /usr/bin/java
- java -version java -version
- It should now indicate that Java 7 or Java 8 is the default runtime environment.
\\ \\
\\ \\
If you need further assistance, please \[contactIGPPNetOps\] . \\ \\ For more information, see https://gist.github.com/johan/10590467 Wiki Markup
If you need further assistance, please contact IGPP NetOps.