[MacPorts] #58098: Install openjdk8 as default JVM
MacPorts
noreply at macports.org
Tue Feb 19 10:38:10 UTC 2019
#58098: Install openjdk8 as default JVM
--------------------------+--------------------
Reporter: giansalvo | Owner: (none)
Type: enhancement | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.5.4
Resolution: | Keywords:
Port: openjdk8 |
--------------------------+--------------------
Comment (by breun):
The standard way of setting your default JVM is by setting the `JAVA_HOME`
environment variable.
When you install the `openjdk8` port this message is displayed explaining
this:
{{{
If you have more than one JDK installed you can make JDK 8 the default
by adding the following line to your Bash shell profile (~/.bash_profile):
export
JAVA_HOME=/Library/Java/JavaVirtualMachines/openjdk8/Contents/Home
}}}
You can check the value of `JAVA_HOME` by running `echo $JAVA_HOME`. On my
machine I get this:
{{{
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/openjdk8/Contents/Home
}}}
What do you get on your machine?
You can run `/usr/libexec/java_home -V` to get a list of all JVM's on your
machine (as long as they're installed under
`/Library/Java/JavaVirtualMachines`).
Another method is using `/usr/libexec/java_home` to find a JVM matching
the desired Java major version like this:
{{{
$ /usr/libexec/java_home -v 1.8
/Library/Java/JavaVirtualMachines/openjdk8/Contents/Home
}}}
You could use that command in your Bash profile like this:
{{{
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
}}}
Although I prefer to set `JAVA_HOME` to an explicit location myself.
--
Ticket URL: <https://trac.macports.org/ticket/58098#comment:3>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list