This is a problem if the app cannot run on a newer version of Java. By default, the OS will run the newest version of Java in the JavaVirtualMachines directory. While the above method works well when running Java from the command line, it will not work well for any application launched in the OS. bash_profile to allow quickly switching between the versions:Īlias j11="export JAVA_HOME=$(/usr/libexec/java_home -v 11) java -version"Īlias j8="export JAVA_HOME=$(/usr/libexec/java_home -v 1.8) java -version" The following aliases could be created in the. ![]() Let's say a user has both Java 8 and Java 11 installed. The java_home executable has access to JDKs & JREs installed here:Ĭommand to list all JDKs/JREs in the JavaVirtualMachines directory: One way to do this is through a combination of using the java_home executable and aliases, but this comes with some pitfalls you need to be aware of. ![]() The version of Java being used is determined by setting the JAVA_HOME system variable. MacOS allows installing different versions of Java. Installing Multiple Versions of Java on Mac
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |