简体   繁体   English

从Java调用球拍

[英]calling racket from Java

I saw this link for calling racket from C/C++ (assuming it's still up to date). 我看到了用于从C / C ++调用球拍的链接 (假设它仍然是最新的)。 Is there a similar way to call racket programs from Java or python? 有没有类似的方法可以从Java或python调用球拍程序?

You can call Racket programs from Java using Process API. 您可以使用Process API从Java调用Racket程序。 some examples here 这里有一些例子

This way You will cal a Racket command with parameters and read from it's out stream. 这样,您将使用参数来校准Racket命令并从流中读取。 Similarly to Unix streams... I do not believe that it is possible to compile everything into one binary like in the link you gave, but it may be good enough workaround/glue code for time. 与Unix流类似,我不认为可以像您给出的链接一样将所有内容编译为一个二进制文件,但是对于时间来说,这可能是足够好的解决方法/胶水代码。

In python, you can do something like this: 在python中,您可以执行以下操作:

from os import system as call
cmd = '/home/n/racket/bin/racket'
call(cmd)

Another way (recommended these days): 另一种方式(最近推荐):

from subprocess import call
call('/home/n/racket/bin/racket', 'tmp.rkt')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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