Java port maintainers: What should be installed on the buildbot workers?

Clemens Lang cal at macports.org
Sat Feb 24 13:57:13 UTC 2018


On Fri, Feb 23, 2018 at 06:43:27PM -0600, Ryan Schmidt wrote:
> 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.

The java portgroup uses /usr/libexec/java_home, which does support
Oracle's Java 8. On my High Sierra install with Oracle Java 8:

 $> /usr/libexec/java_home
 /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home

> 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?

"The class file version for Java SE 8 is 52.0 as per the JVM
Specification. Version 52.0 class files produced by a Java SE 8 compiler
cannot be used in earlier releases of Java SE." [1]

This means that binaries produced on our buildbot with a Java 8 compiler
will only work with Java 8 VMs. Binaries produced with a Java 7 compiler
will work on Java 8 VMs. Java compilers can usually be asked with a
command line switch to emit bytecode compatible with older versions of
Java. See the "-target" option in [2].

I'm not very familiar with Java open source project best practices, but
maybe it is common practice to specify the -source and -target options
anyway, so that our choice of JDK version wouldn't matter?

> 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?

It will work.


Overall, I think we should install JDK 8 where possible. If we need
compatibility with older versions, we should make sure to pass -target
1.7 when compiling.


[1] http://www.oracle.com/technetwork/java/javase/8-compatibility-guide-2156366.html#A999170
[2] https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javac.html


More information about the macports-dev mailing list