如何在运行时将rhino / javascript文件编译为.class bytecode for java [英] How to compile rhino/javascript files to .class bytecode for java at runtime
问题描述
我在Java中进行下沉式沙滩游戏。我希望用户能够使用更简单的语言为自己编写自己的引擎。下降的沙游戏可以是非常CPU密集,所以我想让引擎运行尽可能快,而不必手动编译。
I'm making a falling sand game in Java. I want users to be able to write their own engine for it using a simpler language. Falling sand games can be very CPU intensive so I want to have the engine running as fast as possible while not having to manually compile.
我需要知道如何编译犀牛javascript文件到.class文件在运行时使用。
I need to know how to compile rhino javascript files to .class files by at runtime to be used.
我找到了一种方法,但是找不到任何其他手动编译它使用命令
I've looked for a way but couldn't find any other than manually compiling it by using the command line which I don't want users to have to do.
推荐答案
这里有一个简短的教程:
There's a short tutorial here:
- Scripting: Compiling Scripts in Java
这篇关于如何在运行时将rhino / javascript文件编译为.class bytecode for java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!