![]() It’s really handy that this is set via an environment variable because it allows you to, in tandem with tools like direnv, easily switch between JDK versions depending on the project that you’re working on. ![]() macOS has built-in wrappers for Java commands that will first check this environment variable before trampolining over to the JDK specified by it. JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-11.0.7.jdk/Contents/Home"Īnd you’re done. Using the example above, it would look like this: export You’ve got to set the `JAVA_HOME` environment variable. ![]() The JDK has been extracted to the right place, but it’s still not quite ready to use. Library/Java/JavaVirtualMachines/jdk-11.0.7.jdk/Contents/Home If you did this step right, you’ll have a folder named “jdk-11.0.7.jdk.” There should also be a Contents/Home subfolder of that: Untar the JDK as-is into a subfolder of this. On macOS, the correct place to install a JDK is `/Library/Java/JavaVirtualMachines`. So instead of installing Java any old way, follow these instructions. For example, the version of Gradle used by React Native is incompatible with JDKs newer than 11. Unfortunately, it’s pretty common to want to specify a particular Java version for your project. If you don’t follow it, everything will probably work just fine… at least until you need to switch which version of Java you’re using. There is a correct way to install Java on macOS.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |