> Oracle Java 7 and 8 are compatible with Lion and later. Java 8 requires Mountain Lion: http://www.oracle.com/technetwork/java/javase/certconfig-2095354.html
> My understanding is that one must choose either Apple's Java 6 or Oracle's > Java 7 or 8; they can't coexist. I’m not aware of any scenario where this is the case. You can have umpteen installations of Java coexist at once, living in /Library/Java/JavaVirtualMachines. You will generally set your JAVA_HOME to the one you want to use by default. You can only have one Java in /Library/Internet Plug-Ins/JavaAppletPlugin.plugin, and I believe launching raw JARs or JNLPs will use this Java, but any properly packaged program will come with its own JRE, or have a launch script that uses e.g. /usr/libexec/java_home to discover the appropriate Java. > I think I should probably install Oracle's latest Java 8 on the Lion and > later buildbot workers. Does that seem reasonable? I think that sounds reasonable. Older Javas are already EOL. However per above it will have to be Mountain Lion and later. > I also don't know what happens if we do that, and then a user who has Apple's > legacy Java 6 installed receives a binary archive of a Java-using port. Does > it work? Does it fail? Java binaries have some minimum required JDK version, and are usually forward-compatible. A binary that requires Java 7 or 8 would fail in that scenario (assuming the user *only* has Java 6 installed). A binary requiring Java 6 will generally run on 6 or later, so it would work. I don’t think there’s a good way to test for the minimum required Java for a given binary. I think it would make sense to make that a portgroup property that would be set in each individual portfile. > However, if a Java port would build differently depending on whether Apple's > legacy Java 6 or Oracle's Java 7 or 8 is installed, we may have to prevent > distribution of binary archives of Java ports anyway, at least in the case > where we detect that the Java the user has installed is not the Java that we > decide to install on the buildbot workers. Generally you can build projects on a newer Java than what the project targets, e.g. you can build a Java 7 project with Java 8 and still have it run on Java 7. However this is frowned upon (see https://stackoverflow.com/a/12050087/448068) so if you’re going to be strict about it you probably need to install all available Java versions and make sure only to build with the one required by that project. -Aaron > On Feb 24, 2018, at 9:43, Ryan Schmidt <ryandes...@macports.org> wrote: > > I'd appreciate advice from maintainers of ports that use Java. What Java > should be installed on the buildbot workers? > > Currently, only our Leopard and Snow Leopard buildbot workers have Java > installed, because Apple's Java was included in the Mac OS X installer. It's > a very old version (Java 2 build 1.5.0_30-b03-389-9M3425 on Leopard, Java SE > build 1.6.0_65-b14-462-10M4609 on Snow Leopard) but it's something. > > Apple removed its Java from the OS X installer in Lion, and I have not > separately installed Java on the Lion and later buildbot workers, because I > didn't know what should be installed. > > Apple's legacy Java 6 distribution can be installed on Lion and later up to > and including High Sierra, but Apple doesn't recommend it. They recommend > using the latest Oracle Java. Oracle Java 7 and 8 are compatible with Lion > and later. > > My understanding is that one must choose either Apple's Java 6 or Oracle's > Java 7 or 8; they can't coexist. > > I think I should probably install Oracle's latest Java 8 on the Lion and > later buildbot workers. Does that seem reasonable? I don't know if our java > portgroup is compatible with that. I also don't know what happens if we do > that, and then a user who has Apple's legacy Java 6 installed receives a > binary archive of a Java-using port. Does it work? Does it fail? > > A second option is to install Apple's legacy Java 6 on the Lion and later > buildbot workers. I'm guessing this is not the right choice, since it is old > and probably has security problems. And the same questions arise again: Would > this be compatible with the java portgroup? And what happens if a user who > has Oracle Java 7 or 8 installed gets a binary archive built using legacy > Java 6? Does it work or fail? > > A third option is to do nothing. I think this isn't great because it means > that ports that use Java fail on the Lion and later buildbot workers, which > prevents maintainers from learning about legitimate build failures their > ports may have, and prevents users from receiving binary archives of > distributable Java ports. However, if a Java port would build differently > depending on whether Apple's legacy Java 6 or Oracle's Java 7 or 8 is > installed, we may have to prevent distribution of binary archives of Java > ports anyway, at least in the case where we detect that the Java the user has > installed is not the Java that we decide to install on the buildbot workers. >