简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM