user9024779
user9024779

Reputation: 97

How to compile and run scala code at runtime from a java program?

I already have a program that uses JavaCompiler api for compiling Java code at runtime. Can I use the same compiler for scala code? If not, what is the best way to compile scala code in a Java program?

Thanks

Upvotes: 0

Views: 448

Answers (1)

Ben Weaver
Ben Weaver

Reputation: 970

See the following answer, and in it, also the answer linked by @mastov. You may, however, be able to use the new process handling capabilities in Java 9 instead of ProcessBuilder.

Compile Scala code to .class file, in Java

On Java 9 Process API:

https://www.javaworld.com/article/3176874/java-language/java-9s-other-new-enhancements-part-3.html

Upvotes: 1

Related Questions