hisdrewness
hisdrewness

Reputation: 7651

AWS Lambda JavaCompiler instance

In an AWS Lambda Java 8 Function, is it possible to get an instance of SystemJavaCompiler? Here's a snippet:

final File root = new File("/tmp");    
final File sourceFile = new File(root, type.getSourceFilename());

sourceFile.getParentFile().mkdirs();

Files.write(sourceFile.toPath(), templateString.getBytes(StandardCharsets.UTF_8));

final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
compiler.run(null, null, null, sourceFile.getPath());

I'm attempting to dynamically compile source code in a Lambda and ToolProvider.getSystemJavaCompiler() throws a NullPointerException. This works great locally. I was hoping to avoid deploying an EC2 instance to benefit from the resource savings of Lambda.

Upvotes: 0

Views: 181

Answers (1)

Antoniossss
Antoniossss

Reputation: 32507

Maybe there is no SDK, JRE only.

Upvotes: 1

Related Questions