Java port maintainers: What should be installed on the buildbot workers?
Aaron Madlon-Kay
aaron+macports at madlon-kay.com
Tue Feb 27 05:55:40 UTC 2018
> Thanks, you've cleared up another misconception I had. I had read that
Java 7 installations were being automatically upgraded to Java 8, so I
thought there was no point to trying to install Java 7.
The system-default Java will prompt for updates, but I don't think I've
seen it replace an existing installation without prompting, at least on Mac
(it should require administrator privileges, so I don't think it can).
Regardless, it doesn't prevent you from having multiple JDKs installed.
> I guess I still don't understand what JRE or JVM are. You mentioned
/Library/Java/JavaVirtualMachines, which looks like it contains folders
with names like jdk1.8.0_144.jdk. So does this mean that a JDK is a JVM? Or
that a JDK includes a JVM?
- JRE is the Java Runtime Environment; this is what you need to run a
compiled Java program.
- /Library/Internet Plug-Ins/JavaAppletPlugin.plugin is where the blessed
system-default JRE lives. This path is an artifact of the fact that
Java's raison
d'ĂȘtre used to be browser applets, but at this point it's just kind of
confusing. This JRE is used to run raw JARs or JNLPs you open in the Finder.
- JDK is the Java Development Kit; this is what you need to compile Java
source. The JDK includes a JRE, so if you are a developer you can just
install the JDK and not worry about anything else.
- /Library/Java/JavaVirtualMachines is where JDKs live
- JVM is the Java Virtual Machine; this is a binary included in the JRE
(and therefore in the JDK as well). This is not a separate package at all,
but I appreciate that the alphabet soup is confusing. For our purposes you
can ignore this word.
>> any properly packaged program will come with its own JRE
> Does this include Java-using ports in MacPorts?
No, sorry, that was misleading. I was talking more about large, suite-style
applications like IntelliJ IDEs, where the JRE is included in the binary
distfile, inside the .app bundle. Though I suppose it's not impossible that
a piece of software available in MacPorts might have a distribution that
includes a JRE.
> You mentioned /Library/Internet Plug-Ins/JavaAppletPlugin.plugin. [...]
is this plugin also involved somehow in any part of the MacPorts Java
experience?
Per above, you should think of this less as a plugin and more as the
poorly-named default JRE.
A user who has only installed the JRE will have this plugin, and will be
able to *run* Java programs compatible with that JRE.
A user who has installed the JDK will have this plugin in addition to a JDK
at /Library/Java/JavaVirtualMachines, and will be able to *build and run*
Java programs compatible with that JDK, or any other installed JDK with
proper configuration.
Allow me to preemptively confuse you with one more thing: You may notice
java, javac, javaws etc. in /usr/bin; these are symlinks to binaries in
/System/Library/Frameworks/JavaVM.framework, which in turn are stubs that
forward to the proper Java installation (if available; otherwise it guides
users to download from Oracle). This allows you to invoke /usr/bin/java
without caring where the "real" java binary is. When multiple Javas are
available you should specify the one you want by setting the JAVA_HOME
envar, usually with the output of /usr/libexec/java_home.
-Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20180227/7353c052/attachment.html>
More information about the macports-dev
mailing list