Jdk 8 High Sierra
While working with Ionic and PhoneGap or let’s say anything related to Cordova, I ran into an error requiring Java JDK 1.8 which is required to run the build command. It took a bit of searching to find a concise explanation of how this is done on Mac OSx High Sierra.
The Steps
First find the proper Java Development Kit which is a little confusing because the original error referred to installing JDK 1.8 which which is actually JDK8. Install the following through the standard .dmg method. I found the download here:
Java™ SE Development Kit 8, Update 121 (JDK 8u121) January 17, 2017. The full version string for this update release is 1.8.0121-b13 (where 'b' means 'build'). The version number is 8u121. Aug 21, 2018 how to get JDK 7 for Mac OS High Sierra. Ask Question Asked 2 years, 11 months ago. I need to install specifically JDK 7. I already have JDK 8 up and running. How to get JDK 7 for Mac OS High Sierra. Ask Question Asked 2 years, 11 months ago. I need to install specifically JDK 7. I already have JDK 8 up and running. Derived from Open JDK, Liberica JDK is built against all currently available JDK levels, including the most widespread JDK 8, and JDK 11 up to the latest JDK 16. It is thoroughly tested and supported 24/7. Liberica’s builds are receiving the most extensive platform support and are compatible with the majority of known operating systems, which.
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Next you want to see which version(s) of Java you have available, you can do this with the following command which returned the two versions listed below for me. By default I was using the 9.0.4 version.
Once we have these listed, we can use the following to install the version we want to use. Notice the use of the version listed above. Also notice that the statement uses the back tick not a single quote (found with the tilde).
Now we can run the following command to see which Java version is running on our system.
Which should return something like this:
Conclusion
Again, it seems pretty straight forward and it is but before some research it was still a little unclear. This will last until you reboot your computer and will revert back to the default Java version. I think this is good practice so that anything using the default version can use it and I can switch the version when I’m in code mode developing apps.
Feel free to ask questions or offer comments below!
Question or issue on macOS:
Folks – I am facing challenges while trying to uninstall JDK from my MAC (macOS High Sierra Version 10.13.4 – 17E199). I have two JDK instances installed and I want to uninstall both of them.
I am following the steps listed on this page: https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html
I am trying to run this command in the /Library/Java/JavaVirtualMachines directory which throws an error that I do not have the permission.
I am the administrator of the machine and am not sure what more permission do I need. I have made attempts as the admistrator and as the root user with no success.
Please share your thoughts on this.
How to solve this problem?
Solution no. 1:
From the official Oracle manual.
Navigate to /Library/Java/JavaVirtualMachines and remove the directory whose name matches the following format:
/Library/Java/JavaVirtualMachines/jdkmajor.minor.macro[_update].jdk
For example, to uninstall 8u6:
%rm -rf jdk1.8.0_06.jdk
Do not attempt to uninstall Java by removing the Java tools from /usr/bin. This directory is part of the system software and any changes will be reset by Apple the next time you perform an update of the OS.
To remove system files you need to add sudo before rm -rf command.
Solution no. 2:
This answer is correct for JDK 8, but it would be nice to point out that Oracle provides different instructions for each release of the JDK. The link structure changes slightly for some versions, but generally you can go to https://docs.oracle.com/en/java/javase, select your JDK release, and look for the “Install Guide” link in the Overview group.
For example:
Jdk 8 High Sierra Download
Also, the files in /usr/bin are not part of the JDK, so you don’t really want to remove them. On a system that has never had the JDK installed:
Apparently macOS includes a baseline version of the JDK, where each command is a stub that just prints this message and pops up a dialog in the GUI.
Solution no. 3:
If you want to remove JDK from mac you can use the following command:
Download Jdk 8 For Macos High Sierra
and then use sudo to remove the jdk because you need root permissions to delete jdk from /Library/Java/JavaVirtualMachines/.
/Library/Java/JavaVirtualMachines/ is owned by root.