How can you resolve the following warning
warning: [options] bootstrap class path not set in conjunction with -source 8
when using the internal JavaCompiler
?
Example code (slightly modified from my source):
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
JavaCompiler.CompilationTask task = compiler.getTask(null, null, null, compilerOptions, null, javaFileObjects);
task.call();
The obvious thing I tried was to supply -bootclasspath
to compilerOptions
in the example code above. But you can only supply options in the Option.OptionGroup.BASIC
group (and it is not).
Edit: Some more info: I am using OpenJdk11 and I get the warning for all sources up to 10.
From the compiler, you can get a file manager to set the bootclasspath:
StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null);
List<File> filePaths = ...;
fileManager.setLocation(StandardLocation.PLATFORM_CLASS_PATH, filePaths);
https://docs.oracle.com/javase/8/docs/api/javax/tools/StandardLocation.html#PLATFORM_CLASS_PATH