Hi Greg, Can you try "update-alternatives --config java" ?
-Wei On Tue, 1 Dec 2020 at 19:35, Greg Goodrich <ggoodr...@ippathways.com> wrote: > I’m working on setting up an automated build for CloudStack for 4.14 using > java 11 in a Centos 7 Docker container and was wondering if anyone has > experienced this, and how you solved it. I’m trying to leverage stock > CentOs RPMs, and realized that the Maven install seems to be hard-wired to > Java 8, thus installing it. I’ve also installed Java 11. However, the Java > 8 binaries are installed in the ‘default’ location of /usr/bin/. I’m > setting JAVA_HOME env var so that Maven uses Java 11 when building. > However, the Apidocs build-apidoc.sh script just invokes java within it, > without respect to JAVA_HOME. This causes the build to fail with the > following error: > > > Exception in thread "main" java.lang.UnsupportedClassVersionError: > com/cloud/api/doc/ApiXmlDocWriter has been compiled by a more recent > version of the Java Runtime (class file version 55.0), this version of the > Java Runtime only recognizes class file versions up to 52.0 > > I can manually fix this in a number of ways, but was wondering if the > community has guidance on the best way to go about this. Some > thoughts are: > > > * Don’t use the RPM for Maven, and instead pull a binary bistro down > and install manually via tar, thus alleviating the pinning to Java 8. Then > I could uninstall Java 8 (I use a different container for older CloudStack > builds) and just have Java 11 in the container. > * Manually move the Java 11 binaries into /usr/bin/, overwriting the > Java 8 binaries. This seems complex, as there are bound to be other > dependencies that could get missed in this manual step, such as libraries, > etc. > * Fix build-apidocs.sh to respect JAVA_HOME so that invokes the > correct java binaries. > * Some other option that I’ve not yet thought of. > > Thanks. > > -- > Greg Goodrich | IP Pathways > Senior Developer > 3600 109th Street | Urbandale, IA 50322 > p. 515.422.9346 | e. ggoodr...@ippathways.com<mailto:j...@ippathways.com> > >