I am trying to call javac from within a Cloud Foundry Java app to compile a java file during runtime of the app. I have a question about which JDK is being used.
To test this, in my app, I instantiated a JavaCompiler using statement ToolProvider.getSystemJavaCompiler() and print out the compiler instance. The app was deployed on CF and printed out: com.sun.tools.javac.api.JavacTool@2e68d3ad
The following came from the log.
-----> Java Buildpack Version: v3.13 | https://github.com/cloudfoundry/java-buildpack.git#03b493f 2017-04-24T13:23:21.38-0700 [STG/0] OUT -----> Downloading Open Jdk JRE 1.8.0_121 from https://java-buildpack.cloudfoundry.org/openjdk/trusty/x86_64/openjdk-1.8.0_121.tar.gz (0.5s) 2017-04-24T13:23:22.48-0700 [STG/0] OUT Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.0s)
Two questions:
- Is it safe to assume a JDK is always available on Cloud Foundry, so I can use javac.
- Why the compiler instantiated in my code refers to Sun's javac? I was expecting OpenJDK JDK( even though the log said only the JRE is downloaded ).
Any insight will be appreciated. Thanks. -Michelle